MCPcopy Create free account
hub / github.com/F-Stack/f-stack / benchmark_raidz

Function benchmark_raidz

freebsd/contrib/openzfs/module/zfs/vdev_raidz_math.c:448–514  ·  view source on GitHub ↗

* Initialize and benchmark all supported implementations. */

Source from the content-addressed store, hash-verified

446 * Initialize and benchmark all supported implementations.
447 */
448static void
449benchmark_raidz(void)
450{
451 raidz_impl_ops_t *curr_impl;
452 int i, c;
453
454 /* Move supported impl into raidz_supp_impl */
455 for (i = 0, c = 0; i < ARRAY_SIZE(raidz_all_maths); i++) {
456 curr_impl = (raidz_impl_ops_t *)raidz_all_maths[i];
457
458 if (curr_impl->init)
459 curr_impl->init();
460
461 if (curr_impl->is_supported())
462 raidz_supp_impl[c++] = (raidz_impl_ops_t *)curr_impl;
463 }
464 membar_producer(); /* complete raidz_supp_impl[] init */
465 raidz_supp_impl_cnt = c; /* number of supported impl */
466
467#if defined(_KERNEL)
468 zio_t *bench_zio = NULL;
469 raidz_map_t *bench_rm = NULL;
470 uint64_t bench_parity;
471
472 /* Fake a zio and run the benchmark on a warmed up buffer */
473 bench_zio = kmem_zalloc(sizeof (zio_t), KM_SLEEP);
474 bench_zio->io_offset = 0;
475 bench_zio->io_size = BENCH_ZIO_SIZE; /* only data columns */
476 bench_zio->io_abd = abd_alloc_linear(BENCH_ZIO_SIZE, B_TRUE);
477 memset(abd_to_buf(bench_zio->io_abd), 0xAA, BENCH_ZIO_SIZE);
478
479 /* Benchmark parity generation methods */
480 for (int fn = 0; fn < RAIDZ_GEN_NUM; fn++) {
481 bench_parity = fn + 1;
482 /* New raidz_map is needed for each generate_p/q/r */
483 bench_rm = vdev_raidz_map_alloc(bench_zio, SPA_MINBLOCKSHIFT,
484 BENCH_D_COLS + bench_parity, bench_parity);
485
486 benchmark_raidz_impl(bench_rm, fn, benchmark_gen_impl);
487
488 vdev_raidz_map_free(bench_rm);
489 }
490
491 /* Benchmark data reconstruction methods */
492 bench_rm = vdev_raidz_map_alloc(bench_zio, SPA_MINBLOCKSHIFT,
493 BENCH_COLS, PARITY_PQR);
494
495 for (int fn = 0; fn < RAIDZ_REC_NUM; fn++)
496 benchmark_raidz_impl(bench_rm, fn, benchmark_rec_impl);
497
498 vdev_raidz_map_free(bench_rm);
499
500 /* cleanup the bench zio */
501 abd_free(bench_zio->io_abd);
502 kmem_free(bench_zio, sizeof (zio_t));
503#else
504 /*
505 * Skip the benchmark in user space to avoid impacting libzpool

Callers 1

vdev_raidz_math_initFunction · 0.85

Calls 10

membar_producerFunction · 0.85
abd_alloc_linearFunction · 0.85
memsetFunction · 0.85
abd_to_bufFunction · 0.85
vdev_raidz_map_allocFunction · 0.85
benchmark_raidz_implFunction · 0.85
vdev_raidz_map_freeFunction · 0.85
abd_freeFunction · 0.85
kmem_freeFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected