]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 19 Apr 2008 02:04:38 +0000 (20:04 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 19 Apr 2008 02:04:38 +0000 (20:04 -0600)
Add x86_64 support to XPROF_STATS

include/profiling.h

index f8311a3b8c7f31df26716c71338a85170b857c8b..f47074edc87f40b1e5d574e7f0e42e209c89a996 100644 (file)
@@ -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)