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