about summary refs log tree commit diff
path: root/benchtests/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-10-24 02:19:15 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-10-24 02:19:34 -0700
commit7cc65773f04e0f4252428c40dcbb784a39b58cd1 (patch)
tree8ab811df64ea1c81daac9b4e8b645ea3998acf08 /benchtests/Makefile
parent18ad0de6513bf8a8e4ba757c069e6806d07920f8 (diff)
downloadglibc-7cc65773f04e0f4252428c40dcbb784a39b58cd1.tar.gz
glibc-7cc65773f04e0f4252428c40dcbb784a39b58cd1.tar.xz
glibc-7cc65773f04e0f4252428c40dcbb784a39b58cd1.zip
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.
Diffstat (limited to 'benchtests/Makefile')
-rw-r--r--benchtests/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/benchtests/Makefile b/benchtests/Makefile
index bcd6a9c26d..45aeb5febe 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 :=