This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
add AMD64 timing support to nptl/perf.c
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 22 Sep 2005 03:41:52 -0300
- Subject: add AMD64 timing support to nptl/perf.c
Enable nptl/perf.c to build on x86-64, by providing suitable HP timing
type and macros.
Index: nptl/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* perf.c: Add x86-64 support.
Index: nptl/perf.c
===================================================================
--- nptl/perf.c.orig
+++ nptl/perf.c
@@ -147,9 +147,11 @@ static enum
sync_method;
-/* We use 64bit values for the times. */
+#ifdef __x86_64__
+typedef unsigned long int hp_timing_t;
+#else
typedef unsigned long long int hp_timing_t;
-
+#endif
/* Attributes for all created threads. */
static pthread_attr_t attr;
@@ -705,6 +707,8 @@ clock_getcpuclockid (pid_t pid, clockid_
#ifdef i386
#define HP_TIMING_NOW(Var) __asm__ __volatile__ ("rdtsc" : "=A" (Var))
+#elif __x86_64__
+#define HP_TIMING_NOW(Var) do { unsigned long __low, __high; __asm__ __volatile__ ("rdtsc" : "=a" (__low), "=d" (__high)); (Var) = __low | ((__high) << 32); } while (0)
#elif defined __ia64__
#define HP_TIMING_NOW(Var) __asm__ __volatile__ ("mov %0=ar.itc" : "=r" (Var) : : "memory")
#else
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}