1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Detailed benchmark outputs for functions

This patch adds an option to get detailed benchmark output for
functions.  Invoking the benchmark with 'make DETAILED=1 bench' causes
each benchmark program to store a mean execution time for each input
it works on.  This is useful to give a more comprehensive picture of
performance of functions compared to just the single mean figure.
This commit is contained in:
Siddhesh Poyarekar
2014-03-29 09:40:19 +05:30
parent cb5e4aada7
commit 5673750800
4 changed files with 44 additions and 2 deletions

View File

@ -50,6 +50,7 @@ STRUCT_TEMPLATE = '''
struct args
{
%(args)s
double timing;
};
struct _variants
@ -80,6 +81,9 @@ struct _variants variants[%(num_variants)d] = {
# Epilogue for the generated source file.
EPILOGUE = '''
#define RESULT(__v, __i) (variants[(__v)].in[(__i)].timing)
#define RESULT_ACCUM(r, v, i, old, new) \\
((RESULT ((v), (i))) = (RESULT ((v), (i)) * (old) + (r)) / ((new) + 1))
#define BENCH_FUNC(i, j) ({%(getret)s CALL_BENCH_FUNC (i, j);})
#define FUNCNAME "%(func)s"
#include "bench-skeleton.c"'''
@ -168,7 +172,7 @@ def _print_arg_data(func, directives, all_vals):
# Now print the values.
variants = []
for (k, vals), i in zip(all_vals.items(), itertools.count()):
out = [' {%s},' % v for v in vals]
out = [' {%s, 0},' % v for v in vals]
# Members for the variants structure list that we will
# print later.