]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
benchtests: Add new directive for benchmark initialization hook
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Sat, 22 Feb 2014 04:39:27 +0000 (10:09 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Sat, 22 Feb 2014 04:39:27 +0000 (10:09 +0530)
Add a new 'init' directive that specifies the name of the function to
call to do function-specific initialization.

benchtests/README
benchtests/bench-skeleton.c
scripts/bench.py

index 2a940fab7ff899c5be566e709e735ad02f2d298b..21ba995b10e1fc9e7b43b045c8ad97072a8fdeed 100644 (file)
@@ -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
index 4290e76f315699c590347e0ec6f911888f6752f4..53430d484bdc5a6f00e5358515353773659dac4a 100644 (file)
@@ -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;
index 81ffc152500a2452bd35f195df13cb85c1103a7c..f4ce44faee0cfa091eb050de115eb2384478e96f 100755 (executable)
@@ -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: