blob: de661f8ddecb784ad0335567cab1ba9118636977 (
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
@@ -446,6 +446,14 @@
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
inline std::pair<TimeStamp, CpuId> rdtscp() {
|