X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Ftime.h;h=761dbed3fe870f6e88cca756b830beff2b81405f;hb=3d5e48ba2499fe6a01f48f43a057f3d985ec0ff5;hp=b2d749256d39db737f8ca65174a156ffaeb5c188;hpb=e52d8d880ac644f07154bc2fb94035a198ed6688;p=vpp.git diff --git a/src/vppinfra/time.h b/src/vppinfra/time.h index b2d749256d3..761dbed3fe8 100644 --- a/src/vppinfra/time.h +++ b/src/vppinfra/time.h @@ -39,6 +39,7 @@ #define included_time_h #include +#include typedef struct { @@ -56,10 +57,9 @@ typedef struct from clock cycles into seconds. */ f64 seconds_per_clock; - f64 round_to_units; - /* Time stamp of call to clib_time_init call. */ u64 init_cpu_time; + f64 init_reference_time; u64 last_verify_cpu_time; @@ -67,8 +67,14 @@ typedef struct f64 last_verify_reference_time; u32 log2_clocks_per_second, log2_clocks_per_frequency_verify; + + /* Damping constant */ + f64 damping_constant; + } clib_time_t; +format_function_t format_clib_time; + /* Return CPU time stamp as 64bit number. */ #if defined(__x86_64__) || defined(i386) always_inline u64 @@ -186,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"