vppinfra: fix TSC clock detection on newer intel CPUs
Change-Id: Iff88c9a0dd1b7401605075221640b269bec12859
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/vppinfra/vppinfra/time.c b/vppinfra/vppinfra/time.c
index e62ee86..2bdb9da 100644
--- a/vppinfra/vppinfra/time.c
+++ b/vppinfra/vppinfra/time.c
@@ -38,6 +38,7 @@
#include <vppinfra/os.h>
#include <vppinfra/time.h>
#include <vppinfra/format.h>
+#include <vppinfra/cpu.h>
#ifdef CLIB_UNIX
@@ -143,6 +144,9 @@
{
f64 cpu_freq;
+ if (clib_cpu_supports_invariant_tsc ())
+ return estimate_clock_frequency (1e-3);
+
/* First try /sys version. */
cpu_freq = clock_frequency_from_sys_filesystem ();
if (cpu_freq != 0)