diff options
Diffstat (limited to 'vppinfra/vppinfra/time.h')
-rw-r--r-- | vppinfra/vppinfra/time.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vppinfra/vppinfra/time.h b/vppinfra/vppinfra/time.h index 524eff6c7a1..3c481082ced 100644 --- a/vppinfra/vppinfra/time.h +++ b/vppinfra/vppinfra/time.h @@ -143,8 +143,18 @@ always_inline u64 clib_cpu_time_now (void) return ((u64)h << 32) | l; } -#else +#elif defined (__aarch64__) +always_inline u64 clib_cpu_time_now (void) +{ + u64 tsc; + + /* Works on Cavium ThunderX. Other platforms: YMMV */ + asm volatile("mrs %0, cntvct_el0" : "=r" (tsc)); + return tsc; +} + +#else #error "don't know how to read CPU time stamp" #endif |