From a25166799925db82fc263f6a74d6f83d439922d5 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 27 Jan 2025 08:33:39 +0100 Subject: add a simple sanity check for (single-threaded) read tests --- mbw.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/mbw.c b/mbw.c index 25168c3..712bdbf 100644 --- a/mbw.c +++ b/mbw.c @@ -3,6 +3,7 @@ */ #define _GNU_SOURCE +#include #include #include #include @@ -83,6 +84,9 @@ unsigned int test_type; /* fixed memcpy block size for -t2 */ unsigned long long block_size=DEFAULT_BLOCK_SIZE; +int sanity_check = 0; +long arr_a_sum = 0; + #ifdef NUMA void* mp_pages[1]; int mp_status[1]; @@ -342,6 +346,7 @@ void usage() printf("Options:\n"); printf(" -n: number of runs per test (0 to run forever)\n"); printf(" -a: Don't display average\n"); + printf(" -C: enable sanity checks\n"); printf(" -t%d: memcpy test\n", TEST_MEMCPY); printf(" -t%d: plain (b[i]=a[i] style) test\n", TEST_PLAIN); printf(" -t%d: memcpy test with fixed block size\n", TEST_MCBLOCK); @@ -370,7 +375,7 @@ void usage() /* allocate a test array and fill it with data * so as to force Linux to _really_ allocate it */ -long *make_array() +long *make_array(long *sum) { unsigned long long t; unsigned int long_size=sizeof(long); @@ -391,6 +396,12 @@ long *make_array() for(t=0; t