| 69 | } |
| 70 | |
| 71 | static inline void |
| 72 | run_gen_bench_impl(const char *impl) |
| 73 | { |
| 74 | int fn, ncols; |
| 75 | uint64_t ds, iter_cnt, iter, disksize; |
| 76 | hrtime_t start; |
| 77 | double elapsed, d_bw; |
| 78 | |
| 79 | /* Benchmark generate functions */ |
| 80 | for (fn = 0; fn < RAIDZ_GEN_NUM; fn++) { |
| 81 | |
| 82 | for (ds = MIN_CS_SHIFT; ds <= MAX_CS_SHIFT; ds++) { |
| 83 | /* create suitable raidz_map */ |
| 84 | ncols = rto_opts.rto_dcols + fn + 1; |
| 85 | zio_bench.io_size = 1ULL << ds; |
| 86 | |
| 87 | if (rto_opts.rto_expand) { |
| 88 | rm_bench = vdev_raidz_map_alloc_expanded( |
| 89 | zio_bench.io_abd, |
| 90 | zio_bench.io_size, zio_bench.io_offset, |
| 91 | rto_opts.rto_ashift, ncols+1, ncols, |
| 92 | fn+1, rto_opts.rto_expand_offset); |
| 93 | } else { |
| 94 | rm_bench = vdev_raidz_map_alloc(&zio_bench, |
| 95 | BENCH_ASHIFT, ncols, fn+1); |
| 96 | } |
| 97 | |
| 98 | /* estimate iteration count */ |
| 99 | iter_cnt = GEN_BENCH_MEMORY; |
| 100 | iter_cnt /= zio_bench.io_size; |
| 101 | |
| 102 | start = gethrtime(); |
| 103 | for (iter = 0; iter < iter_cnt; iter++) |
| 104 | vdev_raidz_generate_parity(rm_bench); |
| 105 | elapsed = NSEC2SEC((double)(gethrtime() - start)); |
| 106 | |
| 107 | disksize = (1ULL << ds) / rto_opts.rto_dcols; |
| 108 | d_bw = (double)iter_cnt * (double)disksize; |
| 109 | d_bw /= (1024.0 * 1024.0 * elapsed); |
| 110 | |
| 111 | LOG(D_ALL, "%10s, %8s, %zu, %10llu, %lf, %lf, %u\n", |
| 112 | impl, |
| 113 | raidz_gen_name[fn], |
| 114 | rto_opts.rto_dcols, |
| 115 | (1ULL<<ds), |
| 116 | d_bw, |
| 117 | d_bw * (double)(ncols), |
| 118 | (unsigned)iter_cnt); |
| 119 | |
| 120 | vdev_raidz_map_free(rm_bench); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | static void |
| 126 | run_gen_bench(void) |
no test coverage detected