This is the mail archive of the 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]

[PATCH] Allow adding arbitrary code to benchmark tests


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).


	* Rules ($(objpfx)bench-%.c): Include code from a C source

diff --git a/Rules b/Rules
index bc5dacd..d6157d5 100644
--- a/Rules
+++ b/Rules
@@ -210,8 +210,13 @@ $(binaries-bench): %: %.o \
 $(objpfx)bench-%.c: %-inputs bench-skeleton.c
+	if [ -n "$($*-INCLUDE)" ]; then \
+	  cat $($*-INCLUDE) > $@; \
+	else \
+	  rm -f $@ && touch $@; \
+	fi;
 	$(..)scripts/ $(patsubst %-inputs,%,$<) \
-	  $($*-ITER) $($*-ARGLIST) $($*-RET) > $@
+	  $($*-ITER) $($*-ARGLIST) $($*-RET) >> $@
 .PHONY: distclean realclean subdir_distclean subdir_realclean \

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