aboutsummaryrefslogtreecommitdiff
path: root/Rules
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-03-15 12:30:03 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-03-15 12:30:03 +0530
commit8cfdb7e0560ab27e70a1d2e898fb4a0a67a13c70 (patch)
tree7eb91b35e7d04f1c4889563b3c922e512cfe2045 /Rules
parentd22ca8cdfb98001d03772ef264b244930d439b3f (diff)
downloadglibc-8cfdb7e0560ab27e70a1d2e898fb4a0a67a13c70.zip
glibc-8cfdb7e0560ab27e70a1d2e898fb4a0a67a13c70.tar.gz
glibc-8cfdb7e0560ab27e70a1d2e898fb4a0a67a13c70.tar.bz2
Framework for performance benchmarking of functions
See benchtests/Makefile to know how to use it.
Diffstat (limited to 'Rules')
-rw-r--r--Rules27
1 files changed, 26 insertions, 1 deletions
diff --git a/Rules b/Rules
index 301a748..bc5dacd 100644
--- a/Rules
+++ b/Rules
@@ -83,7 +83,7 @@ common-generated += dummy.o dummy.c
# This makes all the auxiliary and test programs.
-.PHONY: others tests
+.PHONY: others tests bench
ifeq ($(multi-arch),no)
tests := $(filter-out $(tests-ifunc), $(tests))
xtests := $(filter-out $(xtests-ifunc), $(xtests))
@@ -188,6 +188,31 @@ $(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
$(make-test-out) > $@
endif # tests
+
+# Build and run benchmark programs.
+binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
+
+run-bench = $(test-wrapper-env) \
+ GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+ $($*-ENV) $(run-via-rtld-prefix) $${run}
+
+bench: $(binaries-bench)
+ if [ -f $(objpfx)bench.out ]; then \
+ mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
+ fi
+ for run in $^; do \
+ eval $(run-bench) >> $(objpfx)bench.out; \
+ done
+
+$(binaries-bench): %: %.o \
+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+ $(+link)
+
+$(objpfx)bench-%.c: %-inputs bench-skeleton.c
+ $(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
+ $($*-ITER) $($*-ARGLIST) $($*-RET) > $@
+
.PHONY: distclean realclean subdir_distclean subdir_realclean \
subdir_clean subdir_mostlyclean subdir_testclean