From a2cda4ac4c08142e5fc4839ac059dba70d701ccd Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 18 Apr 2008 20:04:38 -0600 Subject: [PATCH] Author: Henrik Nordstrom Add x86_64 support to XPROF_STATS --- include/profiling.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/profiling.h b/include/profiling.h index f8311a3b8c..f47074edc8 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -30,6 +30,17 @@ asm volatile ("rdtsc":"=A" (regs)); /* Note that "rdtsc" is relatively slow OP and stalls the CPU pipes, so use it wisely */ } +#elif defined(__x86_64) || defined(__x86_64__) +static inline hrtime_t +get_tick(void) +{ + uint32_t lo, hi; + // Based on an example in Wikipedia + /* We cannot use "=A", since this would use %rax on x86_64 */ + asm volatile ("rdtsc" : "=a" (lo), "=d" (hi)); + return (hrtime_t)hi << 32 | lo; +} + #elif defined(__alpha) static inline hrtime_t get_tick(void) -- 2.47.2