diff options
Diffstat (limited to 'src/vppinfra/time.h')
-rw-r--r-- | src/vppinfra/time.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vppinfra/time.h b/src/vppinfra/time.h index 4d8997f0a9e..761dbed3fe8 100644 --- a/src/vppinfra/time.h +++ b/src/vppinfra/time.h @@ -192,6 +192,15 @@ clib_cpu_time_now (void) return result; } +#elif defined(__riscv) + +always_inline u64 +clib_cpu_time_now (void) +{ + u64 result; + asm volatile("rdcycle %0\n" : "=r"(result)); + return result; +} #else #error "don't know how to read CPU time stamp" |