diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-03-14 17:47:25 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-03-14 17:47:25 -0700 |
commit | 35c6ac438af5086510fe120b575090cf8e9b917b (patch) | |
tree | 98ca945ba56dafb329224f88d7376a3860cb5ce5 /benchmarks/common/util.h | |
parent | 79e7914a4f33997b110c4a9dfe844561d927b9c0 (diff) | |
download | riscv-tests-35c6ac438af5086510fe120b575090cf8e9b917b.zip riscv-tests-35c6ac438af5086510fe120b575090cf8e9b917b.tar.gz riscv-tests-35c6ac438af5086510fe120b575090cf8e9b917b.tar.bz2 |
Rework benchmarks to run in M-mode
This broadens their utility and lets them use the M-mode counters directly.
Diffstat (limited to 'benchmarks/common/util.h')
-rw-r--r-- | benchmarks/common/util.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index 2fcc89d..c35bf7c 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -126,9 +126,9 @@ static uint64_t lfsr(uint64_t x) #define stringify_1(s) #s #define stringify(s) stringify_1(s) #define stats(code, iter) do { \ - unsigned long _c = -rdcycle(), _i = -rdinstret(); \ + unsigned long _c = -read_csr(mcycle), _i = -read_csr(minstret); \ code; \ - _c += rdcycle(), _i += rdinstret(); \ + _c += read_csr(mcycle), _i += read_csr(minstret); \ 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); \ |