]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add x86_64 support to XPROF_STATS
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 14 Apr 2008 21:29:38 +0000 (23:29 +0200)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 14 Apr 2008 21:29:38 +0000 (23:29 +0200)
include/profiling.h

index e41a2b888b0edb0068bea032e2af8bddfb45e74a..c34e6c6dd063fea41cfa0e7da4de9882c91bc519 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)