mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
benchtests: Add --no-diff and --no-header options
Having a string comparison report with neither diff numbers nor header yields a more useful output to be consumed by other tools. * benchtests/scripts/compare_string.py: Add --no-diff and --no-header options to avoid diff calculation and omit header, respectively. (main): process --no-diff and --no-header
This commit is contained in:
parent
1457016337
commit
195abbf4cd
@ -1,3 +1,9 @@
|
|||||||
|
2018-06-01 Leonardo Sandoval <leonardo.sandoval.gonzalez@intel.com>
|
||||||
|
|
||||||
|
* benchtests/scripts/compare_string.py: Add --no-diff and --no-header
|
||||||
|
options to avoid diff calculation and omit header, respectively.
|
||||||
|
(main): process --no-diff and --no-header
|
||||||
|
|
||||||
2018-06-01 Leonardo Sandoval <leonardo.sandoval.gonzalez@intel.com>
|
2018-06-01 Leonardo Sandoval <leonardo.sandoval.gonzalez@intel.com>
|
||||||
H.J. Lu <hongjiu.lu@intel.com>
|
H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ def draw_graph(f, v, ifuncs, results):
|
|||||||
pylab.savefig('%s-%s.png' % (f, v), bbox_inches='tight')
|
pylab.savefig('%s-%s.png' % (f, v), bbox_inches='tight')
|
||||||
|
|
||||||
|
|
||||||
def process_results(results, attrs, base_func, graph):
|
def process_results(results, attrs, base_func, graph, no_diff, no_header):
|
||||||
""" Process results and print them
|
""" Process results and print them
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -88,16 +88,19 @@ def process_results(results, attrs, base_func, graph):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
for f in results['functions'].keys():
|
for f in results['functions'].keys():
|
||||||
print('Function: %s' % f)
|
|
||||||
v = results['functions'][f]['bench-variant']
|
v = results['functions'][f]['bench-variant']
|
||||||
print('Variant: %s' % v)
|
|
||||||
|
|
||||||
base_index = 0
|
base_index = 0
|
||||||
if base_func:
|
if base_func:
|
||||||
base_index = results['functions'][f]['ifuncs'].index(base_func)
|
base_index = results['functions'][f]['ifuncs'].index(base_func)
|
||||||
|
|
||||||
print("%36s%s" % (' ', '\t'.join(results['functions'][f]['ifuncs'])))
|
if not no_header:
|
||||||
print("=" * 120)
|
print('Function: %s' % f)
|
||||||
|
print('Variant: %s' % v)
|
||||||
|
print("%36s%s" % (' ', '\t'.join(results['functions'][f]['ifuncs'])))
|
||||||
|
print("=" * 120)
|
||||||
|
|
||||||
graph_res = {}
|
graph_res = {}
|
||||||
for res in results['functions'][f]['results']:
|
for res in results['functions'][f]['results']:
|
||||||
attr_list = ['%s=%s' % (a, res[a]) for a in attrs]
|
attr_list = ['%s=%s' % (a, res[a]) for a in attrs]
|
||||||
@ -107,10 +110,11 @@ def process_results(results, attrs, base_func, graph):
|
|||||||
graph_res[key] = res['timings']
|
graph_res[key] = res['timings']
|
||||||
for t in res['timings']:
|
for t in res['timings']:
|
||||||
sys.stdout.write ('%12.2f' % t)
|
sys.stdout.write ('%12.2f' % t)
|
||||||
if i != base_index:
|
if not no_diff:
|
||||||
base = res['timings'][base_index]
|
if i != base_index:
|
||||||
diff = (base - t) * 100 / base
|
base = res['timings'][base_index]
|
||||||
sys.stdout.write (' (%6.2f%%)' % diff)
|
diff = (base - t) * 100 / base
|
||||||
|
sys.stdout.write (' (%6.2f%%)' % diff)
|
||||||
sys.stdout.write('\t')
|
sys.stdout.write('\t')
|
||||||
i = i + 1
|
i = i + 1
|
||||||
print('')
|
print('')
|
||||||
@ -132,7 +136,7 @@ def main(args):
|
|||||||
attrs = args.attributes.split(',')
|
attrs = args.attributes.split(',')
|
||||||
|
|
||||||
results = parse_file(args.input, args.schema)
|
results = parse_file(args.input, args.schema)
|
||||||
process_results(results, attrs, base_func, args.graph)
|
process_results(results, attrs, base_func, args.graph, args.no_diff, args.no_header)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -152,6 +156,10 @@ if __name__ == '__main__':
|
|||||||
help='IFUNC variant to set as baseline.')
|
help='IFUNC variant to set as baseline.')
|
||||||
parser.add_argument('-g', '--graph', action='store_true',
|
parser.add_argument('-g', '--graph', action='store_true',
|
||||||
help='Generate a graph from results.')
|
help='Generate a graph from results.')
|
||||||
|
parser.add_argument('--no-diff', action='store_true',
|
||||||
|
help='Do not print the difference from baseline.')
|
||||||
|
parser.add_argument('--no-header', action='store_true',
|
||||||
|
help='Do not print the header.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
Loading…
Reference in New Issue
Block a user