about summary refs log tree commit diff
path: root/benchtests/scripts
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-02-22 10:09:27 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-05-26 12:37:29 +0530
commit15eaf6ffe3e117684a0e7b070c0a8754480d3fa3 (patch)
treefb9f01290abc80717a41e623699dfec063c1b0df /benchtests/scripts
parent75f11331f98ebf3873e887a683add944a1aec0fd (diff)
downloadglibc-15eaf6ffe3e117684a0e7b070c0a8754480d3fa3.tar.gz
glibc-15eaf6ffe3e117684a0e7b070c0a8754480d3fa3.tar.xz
glibc-15eaf6ffe3e117684a0e7b070c0a8754480d3fa3.zip
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.  This is useful for
benchmarks that need to do a one-time initialization before the
functions are executed.
Diffstat (limited to 'benchtests/scripts')
-rwxr-xr-xbenchtests/scripts/bench.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/benchtests/scripts/bench.py b/benchtests/scripts/bench.py
index 492c764aa7..eb5a14141a 100755
--- a/benchtests/scripts/bench.py
+++ b/benchtests/scripts/bench.py
@@ -128,6 +128,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})
 
 
@@ -232,7 +236,8 @@ def parse_file(func):
             'args': [],
             'includes': [],
             'include-sources': [],
-            'ret': ''
+            'ret': '',
+            'init': ''
     }
 
     try: