This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Allow adding arbitrary code to benchmark tests
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 20 Mar 2013 16:01:33 +0530
- Subject: [PATCH] Allow adding arbitrary code to benchmark tests
Hi,
Here's a little tweak to add code into a benchmark to customize it.
The current use for this is to separate the fast and slow path
benchmarks for pow and exp (and other math functions once I get to
identifying inputs for them). A future intended use is to be able to
benchmark 'scenarios' i.e. a function that does a set of tasks (e.g. a
producer-consumer scenario using threads).
Siddhesh
* Rules ($(objpfx)bench-%.c): Include code from a C source
file.
diff --git a/Rules b/Rules
index bc5dacd..d6157d5 100644
--- a/Rules
+++ b/Rules
@@ -210,8 +210,13 @@ $(binaries-bench): %: %.o \
$(+link)
$(objpfx)bench-%.c: %-inputs bench-skeleton.c
+ if [ -n "$($*-INCLUDE)" ]; then \
+ cat $($*-INCLUDE) > $@; \
+ else \
+ rm -f $@ && touch $@; \
+ fi;
$(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
- $($*-ITER) $($*-ARGLIST) $($*-RET) > $@
+ $($*-ITER) $($*-ARGLIST) $($*-RET) >> $@
.PHONY: distclean realclean subdir_distclean subdir_realclean \