diff options
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index 7cb2ff81a..9c2af41e3 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -70,9 +70,11 @@ #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #endif -#ifdef HAVE_RDTSCP +#ifdef HAVE_RDTSC +#ifdef __x86_64__ #include <x86intrin.h> #endif +#endif #include <math.h> /* for pow */ #include "cryptobox.h" @@ -1768,17 +1770,18 @@ rspamd_get_ticks (gboolean rdtsc_ok) { gdouble res; -#ifdef HAVE_RDTSCP - guint tmp; +#ifdef HAVE_RDTSC +# ifdef __x86_64__ guint64 r64; if (rdtsc_ok) { - r64 = __builtin_ia32_rdtscp (&tmp); + __builtin_ia32_lfence (); + r64 = __rdtsc (); /* Preserve lower 52 bits */ res = r64 & ((1ULL << 53) - 1); return res; } - +# endif #endif #ifdef HAVE_CLOCK_GETTIME struct timespec ts; |