From 2e158c7f324f886b0832a063b32c74d69f986ddc Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Mon, 14 Apr 2008 23:29:38 +0200 Subject: [PATCH] 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 e41a2b888b..c34e6c6dd0 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.3