aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/common/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/common/util.h')
-rw-r--r--benchmarks/common/util.h4
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); \