diff options
author | Henry Cook <hcook@eecs.berkeley.edu> | 2014-11-06 17:24:39 -0800 |
---|---|---|
committer | Henry Cook <hcook@eecs.berkeley.edu> | 2014-11-07 16:52:51 -0800 |
commit | d537de7deffa6036dab573ff174b7f8c8e470437 (patch) | |
tree | ddc921eb337cda4889570f0251bdba85059a2531 /benchmarks/common/util.h | |
parent | 5afc6b9bc2e3685220cffb3da66ad9f5f1f7b14f (diff) | |
download | riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.zip riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.gz riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.bz2 |
Clean up canonical mt benchmarks and reorganize extra versions in /mt. All versions support support at least 1/2/4 threads.
Diffstat (limited to 'benchmarks/common/util.h')
-rw-r--r-- | benchmarks/common/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index 6c4f963..638f024 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -113,4 +113,15 @@ static void __attribute__((noinline)) barrier(int ncores) #include "encoding.h" #endif +#define stringify_1(s) #s +#define stringify(s) stringify_1(s) +#define stats(code, iter) do { \ + unsigned long _c = -rdcycle(), _i = -rdinstret(); \ + code; \ + _c += rdcycle(), _i += rdinstret(); \ + if (cid == 0) \ + printf("\n%s: %ld cycles, %ld.%ld cycles/iter, %ld.%ld CPI\n", \ + stringify(code), _c, _c/iter, 10*_c/iter%10, _c/_i, 10*_c/_i%10); \ + } while(0) + #endif //__UTIL_H |