From 07062227a96adc76a2796f7d83b9c2d9f4aa87c1 Mon Sep 17 00:00:00 2001 From: Valentin Hilbig Date: Sat, 30 Nov 2019 17:58:10 +0100 Subject: [PATCH] speed-test for other than 8 disks The undocumented option -T (aka --speed-test) already has an undocumented option to run a shorter test: --test-skip-device In a similar fashion, option -pX or --plan X now affects the number of disks taken in account for the speed test. As before the default is 8. --- cmdline/snapraid.c | 2 +- cmdline/snapraid.h | 2 +- cmdline/speed.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index ec4f839b..b1a2da5f 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -923,7 +923,7 @@ int main(int argc, char* argv[]) crc32c_init(); if (speedtest != 0) { - speed(period); + speed(period, plan); os_done(); exit(EXIT_SUCCESS); } diff --git a/cmdline/snapraid.h b/cmdline/snapraid.h index e12cbcb1..14a90317 100644 --- a/cmdline/snapraid.h +++ b/cmdline/snapraid.h @@ -21,7 +21,7 @@ /****************************************************************************/ /* snapraid */ -void speed(int period); +void speed(int period, int cnt); void selftest(void); #endif diff --git a/cmdline/speed.c b/cmdline/speed.c index f3ecdf8f..7a38df29 100644 --- a/cmdline/speed.c +++ b/cmdline/speed.c @@ -75,7 +75,7 @@ static int64_t diffgettimeofday(struct timeval *start, struct timeval *stop) */ static unsigned side_effect; -void speed(int period) +void speed(int period, int cnt) { struct timeval start; struct timeval stop; @@ -89,7 +89,7 @@ void speed(int period) int count; int delta = period >= 1000 ? 10 : 1; int size = TEST_SIZE; - int nd = TEST_COUNT; + int nd = cnt>0 ? cnt : TEST_COUNT; int nv; void *v_alloc; void **v;