about summary refs log tree commit diff
path: root/sysdeps/x86_64/hp-timing.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/x86_64/hp-timing.h
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sysdeps/x86_64/hp-timing.h')
-rw-r--r--sysdeps/x86_64/hp-timing.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
index e015ff79db..59a29abd45 100644
--- a/sysdeps/x86_64/hp-timing.h
+++ b/sysdeps/x86_64/hp-timing.h
@@ -1,5 +1,5 @@
 /* High precision, low overhead timing functions.  x86-64 version.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,11 @@
 
 /* The funny business for 32-bit mode is not required here.  */
 # undef HP_TIMING_ACCUM
-# define HP_TIMING_ACCUM(Sum, Diff) ((Sum) += (Diff))
-
+# define HP_TIMING_ACCUM(Sum, Diff)					      \
+  do {									      \
+    hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
+    __asm__ __volatile__ ("lock; addq %1, %0"				      \
+			  : "=m" (Sum) : "r" (__diff), "m" (Sum));	      \
+  } while (0)
 
 #endif /* hp-timing.h */