This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Allow adding arbitrary code to benchmark tests
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 21 Mar 2013 16:39:14 +0530
- Subject: Re: [PATCH v3] Allow adding arbitrary code to benchmark tests
- References: <20130320103133 dot GW25837 at spoyarek dot pnq dot redhat dot com> <mvmtxo6icbr dot fsf at hawking dot suse dot de> <20130320120901 dot GY25837 at spoyarek dot pnq dot redhat dot com> <mvmppyui52l dot fsf at hawking dot suse dot de> <20130320134807 dot GZ25837 at spoyarek dot pnq dot redhat dot com> <mvmtxo5gh6x dot fsf at hawking dot suse dot de>
On Thu, Mar 21, 2013 at 11:50:30AM +0100, Andreas Schwab wrote:
> Siddhesh Poyarekar <siddhesh@redhat.com> writes:
>
> > $(objpfx)bench-%.c: %-inputs bench-skeleton.c
> > + { if [ -n "$($*-INCLUDE)" ]; then \
> > + cat $($*-INCLUDE); \
> > + fi; \
> > $(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
> > - $($*-ITER) $($*-ARGLIST) $($*-RET) > $@
> > + $($*-ITER) $($*-ARGLIST) $($*-RET); } > $@
>
> One more thing: please output to a temporary file and move it to the
> target afterwards. Otherwise looks good.
>
Thanks, here's what I finally pushed:
commit 3775a8bc2d2e0c29c8a7e673f5f42537ced2b3c7
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Mar 21 16:35:48 2013 +0530
Allow adding of arbitrary code to benchmark tests
This allows us to define custom functions in C code files and
benchmark scenarios rather than just functions. The main current use
of this is to separate the slow and fast path benchmarks for math
functions.
diff --git a/ChangeLog b/ChangeLog
index 858b9fa..3ffaa38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-21 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * Rules ($(objpfx)bench-%.c): Include code from a C source
+ file.
+
2013-03-21 Joseph Myers <joseph@codesourcery.com>
[BZ #15287]
diff --git a/Rules b/Rules
index bc5dacd..02cdb4a 100644
--- a/Rules
+++ b/Rules
@@ -210,8 +210,12 @@ $(binaries-bench): %: %.o \
$(+link)
$(objpfx)bench-%.c: %-inputs bench-skeleton.c
+ { if [ -n "$($*-INCLUDE)" ]; then \
+ cat $($*-INCLUDE); \
+ fi; \
$(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
- $($*-ITER) $($*-ARGLIST) $($*-RET) > $@
+ $($*-ITER) $($*-ARGLIST) $($*-RET); } > $@-tmp
+ mv -f $@-tmp $@
.PHONY: distclean realclean subdir_distclean subdir_realclean \