diff options
author | raas <andras.horvath@gmail.com> | 2015-05-06 23:03:52 +0200 |
---|---|---|
committer | raas <andras.horvath@gmail.com> | 2015-05-06 23:03:52 +0200 |
commit | be8c2af95315e53c4ae90ccd50a36e99512acae1 (patch) | |
tree | db486224859c8f50014096b8f1c229094c49de8d | |
parent | 4b98b5581cecd79446f65748fb7a8ed686f47c9f (diff) | |
parent | 6aefa9b8d5be1c9425d0a30fd7e6aaeda74878a9 (diff) |
Merge pull request #4 from sbates130272/master
Added -n 0 option to run loops forever
-rw-r--r-- | mbw.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -35,7 +35,7 @@ * MBW memory bandwidth benchmark * * 2006, 2012 Andras.Horvath@gmail.com - * 2013 j.m.slocum@gmail.com + * 2013 j.m.slocum@gmail.com * (Special thanks to Stephen Pasich) * * http://github.com/raas/mbw @@ -57,7 +57,7 @@ void usage() printf("mbw memory benchmark v%s, https://github.com/raas/mbw\n", VERSION); printf("Usage: mbw [options] array_size_in_MiB\n"); printf("Options:\n"); - printf(" -n: number of runs per test\n"); + printf(" -n: number of runs per test (0 to run forever)\n"); printf(" -a: Don't display average\n"); printf(" -t%d: memcpy test\n", TEST_MEMCPY); printf(" -t%d: dumb (b[i]=a[i] style) test\n", TEST_DUMB); @@ -238,6 +238,11 @@ int main(int argc, char **argv) tests[2]=1; } + if( nr_loops==0 && ((tests[0]+tests[1]+tests[2]) != 1) ) { + printf("Error: nr_loops can be zero if only one test selected!\n"); + exit(1); + } + if(optind<argc) { mt=strtoul(argv[optind++], (char **)NULL, 10); } else { @@ -280,7 +285,7 @@ int main(int argc, char **argv) for(testno=0; testno<MAX_TESTS; testno++) { te_sum=0; if(tests[testno]) { - for (i=0; i<nr_loops; i++) { + for (i=0; nr_loops==0 || i<nr_loops; i++) { te=worker(asize, a, b, testno, block_size); te_sum+=te; printf("%d\t", i); |