This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.28.9000-212-g7cc6577


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7cc65773f04e0f4252428c40dcbb784a39b58cd1 (commit)
      from  18ad0de6513bf8a8e4ba757c069e6806d07920f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7cc65773f04e0f4252428c40dcbb784a39b58cd1

commit 7cc65773f04e0f4252428c40dcbb784a39b58cd1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Oct 24 02:19:15 2018 -0700

    x86: Support RDTSCP for benchtests
    
    RDTSCP waits until all previous instructions have executed and all
    previous loads are globally visible before reading the counter.  RDTSC
    doesn't wait until all previous instructions have been executed before
    reading the counter.  All x86 processors since 2010 support RDTSCP
    instruction.  This patch adds RDTSCP support to benchtests.
    
    	* benchtests/Makefile (CPPFLAGS-nonlib): Add -DUSE_RDTSCP if
    	USE_RDTSCP is defined.
    	* sysdeps/x86/hp-timing.h (HP_TIMING_NOW): Use RDTSCP if
    	USE_RDTSCP is defined.

diff --git a/ChangeLog b/ChangeLog
index 6cb7d60..cda75db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* benchtests/Makefile (CPPFLAGS-nonlib): Add -DUSE_RDTSCP if
+	USE_RDTSCP is defined.
+	* sysdeps/x86/hp-timing.h (HP_TIMING_NOW): Use RDTSCP if
+	USE_RDTSCP is defined.
+
 2018-10-23  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* misc/tst-preadvwritev2-common.c (IOV_MAX): Define if not
diff --git a/benchtests/Makefile b/benchtests/Makefile
index bcd6a9c..45aeb5f 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -131,6 +131,12 @@ CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION) -D_ISOMAC
 # HP_TIMING if it is available.
 ifdef USE_CLOCK_GETTIME
 CPPFLAGS-nonlib += -DUSE_CLOCK_GETTIME
+else
+# On x86 processors, use RDTSCP, instead of RDTSC, to measure performance
+# of functions.  All x86 processors since 2010 support RDTSCP instruction.
+ifdef USE_RDTSCP
+CPPFLAGS-nonlib += -DUSE_RDTSCP
+endif
 endif
 
 DETAILED_OPT :=
diff --git a/benchtests/README b/benchtests/README
index 4ddff79..aaf0b65 100644
--- a/benchtests/README
+++ b/benchtests/README
@@ -34,6 +34,15 @@ the benchmark to use clock_gettime by invoking make as follows:
 
 Again, one must run `make bench-clean' before changing the measurement method.
 
+On x86 processors, RDTSCP instruction provides more precise timing data
+than RDTSC instruction.  All x86 processors since 2010 support RDTSCP
+instruction.  One can force the benchmark to use RDTSCP by invoking make
+as follows:
+
+  $ make USE_RDTSCP=1 bench
+
+One must run `make bench-clean' before changing the measurement method.
+
 Running benchmarks on another target:
 ====================================
 
diff --git a/sysdeps/x86/hp-timing.h b/sysdeps/x86/hp-timing.h
index 77a1360..0aa6f5e 100644
--- a/sysdeps/x86/hp-timing.h
+++ b/sysdeps/x86/hp-timing.h
@@ -40,7 +40,19 @@ typedef unsigned long long int hp_timing_t;
 
    NB: Use __builtin_ia32_rdtsc directly since including <x86intrin.h>
    makes building glibc very slow.  */
-# define HP_TIMING_NOW(Var)	((Var) = __builtin_ia32_rdtsc ())
+# ifdef USE_RDTSCP
+/* RDTSCP waits until all previous instructions have executed and all
+   previous loads are globally visible before reading the counter.
+   RDTSC doesn't wait until all previous instructions have been executed
+   before reading the counter.  */
+#  define HP_TIMING_NOW(Var) \
+  (__extension__ ({				\
+    unsigned int __aux;				\
+    (Var) = __builtin_ia32_rdtscp (&__aux);	\
+  }))
+# else
+#  define HP_TIMING_NOW(Var) ((Var) = __builtin_ia32_rdtsc ())
+# endif
 
 # include <hp-timing-common.h>
 #else

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    7 +++++++
 benchtests/Makefile     |    6 ++++++
 benchtests/README       |    9 +++++++++
 sysdeps/x86/hp-timing.h |   14 +++++++++++++-
 4 files changed, 35 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]