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.
+2014-05-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * benchtests/README: Document 'init' directive.
+ * benchtests/bench-skeleton.c (main) [BENCH_INIT]: Call
+ BENCH_INIT.
+ * scripts/bench.py (gen_source): Define BENCH_INIT macro.
+ (parse_file): Recognize 'init' directive.
+
2014-05-26 Kyle McMartin <kyle@redhat.com>
[BZ #16796]
and functions (specifically, this includes using "#include "source").
See pthread_once-inputs and pthreads_once-source.c for an example of how
to use this to benchmark a function that needs state across several calls.
+ - 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
unsigned long iters, res;
+#ifdef BENCH_INIT
+ BENCH_INIT ();
+#endif
TIMING_INIT (res);
iters = 1000 * res;
else:
getret = ''
+ # Test initialization.
+ if directives['init']:
+ print('#define BENCH_INIT %s' % directives['init'])
+
print(EPILOGUE % {'getret': getret, 'func': func})
'args': [],
'includes': [],
'include-sources': [],
- 'ret': ''
+ 'ret': '',
+ 'init': ''
}
try: