diff options
| author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-02-22 10:09:27 +0530 |
|---|---|---|
| committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-02-22 10:09:27 +0530 |
| commit | 21e0d3b8076ad3870cf82e91c48f0ecfb17f0c83 (patch) | |
| tree | ef1f10e58482be429627afd4c3f29360a5bd95de | |
| parent | 9656e13b7c71ee100e744546626d8c73cf91e8d9 (diff) | |
| download | glibc-21e0d3b8076ad3870cf82e91c48f0ecfb17f0c83.tar.gz | |
benchtests: Add new directive for benchmark initialization hook
Add a new 'init' directive that specifies the name of the function to
call to do function-specific initialization.
| -rw-r--r-- | benchtests/README | 1 | ||||
| -rw-r--r-- | benchtests/bench-skeleton.c | 3 | ||||
| -rwxr-xr-x | scripts/bench.py | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/benchtests/README b/benchtests/README index 2a940fab7f..21ba995b10 100644 --- a/benchtests/README +++ b/benchtests/README @@ -60,6 +60,7 @@ one to add `foo' to the bench tests: - include-sources: This should be assigned a comma-separated list of source files that need to be included to provide definitions of global variables and functions (specifically, this includes using "#include "source"). + - init: Name of an initializer function to call to initialize the benchtest. - name: See following section for instructions on how to use this directive. Lines beginning with a single hash '#' are treated as comments. See diff --git a/benchtests/bench-skeleton.c b/benchtests/bench-skeleton.c index 4290e76f31..53430d484b 100644 --- a/benchtests/bench-skeleton.c +++ b/benchtests/bench-skeleton.c @@ -55,6 +55,9 @@ main (int argc, char **argv) unsigned long iters, res; +#ifdef BENCH_INIT + BENCH_INIT (); +#endif TIMING_INIT (res); iters = 1000 * res; diff --git a/scripts/bench.py b/scripts/bench.py index 81ffc15250..f4ce44faee 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -124,6 +124,10 @@ def gen_source(func, directives, all_vals): else: getret = '' + # Test initialization. + if directives['init']: + print('#define BENCH_INIT %s' % directives['init']) + print(EPILOGUE % {'getret': getret, 'func': func}) @@ -228,7 +232,8 @@ def parse_file(func): 'args': [], 'includes': [], 'include-sources': [], - 'ret': '' + 'ret': '', + 'init': '' } try: |
