From 6346daa765f85d47caa39685fb452701d82446d5 Mon Sep 17 00:00:00 2001 From: Andras HORVATH Date: Mon, 17 Feb 2014 22:07:10 +0100 Subject: Fix labeling of the displayed results. --- mbw.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/mbw.c b/mbw.c index 6251ea9..06a9d09 100644 --- a/mbw.c +++ b/mbw.c @@ -23,6 +23,11 @@ /* default block size for test 2, in bytes */ #define DEFAULT_BLOCK_SIZE 262144 +/* test types */ +#define TEST_MEMCPY 0 +#define TEST_DUMB 1 +#define TEST_MCBLOCK 2 + /* * MBW memory bandwidth benchmark * @@ -50,9 +55,9 @@ void usage() printf("Options:\n"); printf(" -n: number of runs per test\n"); printf(" -a: Don't display average\n"); - printf(" -t0: memcpy test\n"); - printf(" -t1: dumb (b[i]=a[i] style) test\n"); - printf(" -t2 : memcpy test with fixed block size\n"); + printf(" -t%d: memcpy test\n", TEST_MEMCPY); + printf(" -t%d: dumb (b[i]=a[i] style) test\n", TEST_DUMB); + printf(" -t%d: memcpy test with fixed block size\n", TEST_MCBLOCK); printf(" -b : block size in bytes for -t2 (default: %d)\n", DEFAULT_BLOCK_SIZE); printf(" -q: quiet (print statistics only)\n"); printf("(will then use two arrays, watch out for swapping)\n"); @@ -100,13 +105,13 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon /* array size in bytes */ unsigned long long array_bytes=asize*long_size; - if(type==1) { /* memcpy test */ + if(type==TEST_MEMCPY) { /* memcpy test */ /* timer starts */ gettimeofday(&starttime, NULL); memcpy(b, a, array_bytes); /* timer stops */ gettimeofday(&endtime, NULL); - } else if(type==2) { /* memcpy block test */ + } else if(type==TEST_MCBLOCK) { /* memcpy block test */ char* aa = (char*)a; char* bb = (char*)b; gettimeofday(&starttime, NULL); @@ -117,7 +122,7 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon bb=mempcpy(bb, aa, t); } gettimeofday(&endtime, NULL); - } else { /* dumb test */ + } else if(type==TEST_DUMB) { /* dumb test */ gettimeofday(&starttime, NULL); for(t=0; t