blob: 7038dbfe7b12da174c28e562609192ca8d824d07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
diff -Naur a/hbt/src/common/System.h b/hbt/src/common/System.h
--- a/hbt/src/common/System.h 2024-01-21 15:26:26.940486370 +0000
+++ b/hbt/src/common/System.h 2024-01-21 22:22:36.713134358 +0000
@@ -445,6 +445,14 @@
asm volatile("mrs %0, cntvct_el0" : "=r"(tstamp));
cpu = getCpu();
return tstamp;
+#elif defined(__riscv)
+inline TimeStamp rdtscp(CpuId& cpu) {
+ TimeStamp tstamp;
+ // Use the RDCYCLE instruction for RISC-V.
+ asm volatile("rdcycle %0" : "=r"(tstamp));
+ cpu = getCpu();
+ return tstamp;
+
}
#endif
|