From: Henrik Nordstrom Date: Mon, 14 Apr 2008 21:29:38 +0000 (+0200) Subject: Add x86_64 support to XPROF_STATS X-Git-Tag: SQUID_3_1_0_1~49^2~292 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e158c7f324f886b0832a063b32c74d69f986ddc;p=thirdparty%2Fsquid.git Add x86_64 support to XPROF_STATS --- 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)