summaryrefslogtreecommitdiffstats
path: root/cmd/raidz_test
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2016-07-17 19:41:11 +0200
committerBrian Behlendorf <[email protected]>2016-07-19 16:43:07 -0700
commitc9187d867fee3972de48b71762407ae7dabb2563 (patch)
treec1d7fdb7f5761cba9aa14f0743b8c3a57def392f /cmd/raidz_test
parent1d9b3bd8fb2b633b7523d9f39149d76e24ffb535 (diff)
Fixes and enhancements of SIMD raidz parity
- Implementation lock replaced with atomic variable - Trailing whitespace is removed from user specified parameter, to enhance experience when using commands that add newline, e.g. `echo` - raidz_test: remove dependency on `getrusage()` and RUSAGE_THREAD, Issue #4813 - silence `cppcheck` in vdev_raidz, partial solution of Issue #1392 - Minor fixes and cleanups - Enable use of original parity methods in [fastest] configuration. New opaque original ops structure, representing native methods, is added to supported raidz methods. Original parity methods are executed if selected implementation has NULL fn pointer. Signed-off-by: Gvozden Neskovic <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #4813 Issue #1392
Diffstat (limited to 'cmd/raidz_test')
-rw-r--r--cmd/raidz_test/raidz_bench.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/cmd/raidz_test/raidz_bench.c b/cmd/raidz_test/raidz_bench.c
index 040171a38..f1710ccc7 100644
--- a/cmd/raidz_test/raidz_bench.c
+++ b/cmd/raidz_test/raidz_bench.c
@@ -32,7 +32,6 @@
#include <stdio.h>
#include <sys/time.h>
-#include <sys/resource.h>
#include "raidz_test.h"
@@ -42,7 +41,6 @@
#define MIN_CS_SHIFT BENCH_ASHIFT
#define MAX_CS_SHIFT SPA_MAXBLOCKSHIFT
-
static zio_t zio_bench;
static raidz_map_t *rm_bench;
static size_t max_data_size = SPA_MAXBLOCKSIZE;
@@ -70,28 +68,18 @@ bench_fini_raidz_maps(void)
bzero(&zio_bench, sizeof (zio_t));
}
-static double
-get_time_diff(struct rusage *start, struct rusage *stop)
-{
- return (((double)stop->ru_utime.tv_sec * (double)MICROSEC +
- (double)stop->ru_utime.tv_usec) -
- ((double)start->ru_utime.tv_sec * (double)MICROSEC +
- (double)start->ru_utime.tv_usec)) / (double)MICROSEC;
-}
-
static inline void
run_gen_bench_impl(const char *impl)
{
int fn, ncols;
uint64_t ds, iter_cnt, iter, disksize;
- struct rusage start, stop;
+ hrtime_t start;
double elapsed, d_bw;
/* Benchmark generate functions */
for (fn = 0; fn < RAIDZ_GEN_NUM; fn++) {
for (ds = MIN_CS_SHIFT; ds <= MAX_CS_SHIFT; ds++) {
-
/* create suitable raidz_map */
ncols = rto_opts.rto_dcols + fn + 1;
zio_bench.io_size = 1ULL << ds;
@@ -102,12 +90,11 @@ run_gen_bench_impl(const char *impl)
iter_cnt = GEN_BENCH_MEMORY;
iter_cnt /= zio_bench.io_size;
- getrusage(RUSAGE_THREAD, &start);
+ start = gethrtime();
for (iter = 0; iter < iter_cnt; iter++)
vdev_raidz_generate_parity(rm_bench);
- getrusage(RUSAGE_THREAD, &stop);
+ elapsed = NSEC2SEC((double) (gethrtime() - start));
- elapsed = get_time_diff(&start, &stop);
disksize = (1ULL << ds) / rto_opts.rto_dcols;
d_bw = (double)iter_cnt * (double)disksize;
d_bw /= (1024.0 * 1024.0 * elapsed);
@@ -147,9 +134,9 @@ run_gen_bench(void)
static void
run_rec_bench_impl(const char *impl)
{
- struct rusage start, stop;
int fn, ncols, nbad;
uint64_t ds, iter_cnt, iter, disksize;
+ hrtime_t start;
double elapsed, d_bw;
static const int tgt[7][3] = {
{1, 2, 3}, /* rec_p: bad QR & D[0] */
@@ -187,12 +174,11 @@ run_rec_bench_impl(const char *impl)
nbad = MIN(3, raidz_ncols(rm_bench) -
raidz_parity(rm_bench));
- getrusage(RUSAGE_THREAD, &start);
+ start = gethrtime();
for (iter = 0; iter < iter_cnt; iter++)
vdev_raidz_reconstruct(rm_bench, tgt[fn], nbad);
- getrusage(RUSAGE_THREAD, &stop);
+ elapsed = NSEC2SEC((double) (gethrtime() - start));
- elapsed = get_time_diff(&start, &stop);
disksize = (1ULL << ds) / rto_opts.rto_dcols;
d_bw = (double)iter_cnt * (double)(disksize);
d_bw /= (1024.0 * 1024.0 * elapsed);