mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
benchtests: New -g option to generate graphs in compare_strings.py
The compare_strings.py option unconditionally generates a graph PNG image of the input data, which can be unnecessary and slow. Put this behind an optional flag -g. * benchtests/scripts/compare_strings.py: New option -g. (draw_graph): Print a message that a graph is being generated. (process_results): Generate graph only if -g is passed. (main): Process option -g.
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
2017-09-16 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
2017-09-16 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
|
||||||
|
* benchtests/scripts/compare_strings.py: New option -g.
|
||||||
|
(draw_graph): Print a message that a graph is being generated.
|
||||||
|
(process_results): Generate graph only if -g is passed.
|
||||||
|
(main): Process option -g.
|
||||||
|
|
||||||
* benchtests/scripts/compare_strings.py (process_results):
|
* benchtests/scripts/compare_strings.py (process_results):
|
||||||
Better spacing for output.
|
Better spacing for output.
|
||||||
|
|
||||||
|
@@ -57,6 +57,7 @@ def draw_graph(f, v, ifuncs, results):
|
|||||||
ifuncs: List of ifunc names
|
ifuncs: List of ifunc names
|
||||||
results: Dictionary of results for each test criterion
|
results: Dictionary of results for each test criterion
|
||||||
"""
|
"""
|
||||||
|
print('Generating graph for %s, variant \'%s\'' % (f, v))
|
||||||
xkeys = results.keys()
|
xkeys = results.keys()
|
||||||
|
|
||||||
pylab.clf()
|
pylab.clf()
|
||||||
@@ -78,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):
|
def process_results(results, attrs, base_func, graph):
|
||||||
""" Process results and print them
|
""" Process results and print them
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -113,7 +114,9 @@ def process_results(results, attrs, base_func):
|
|||||||
sys.stdout.write('\t')
|
sys.stdout.write('\t')
|
||||||
i = i + 1
|
i = i + 1
|
||||||
print('')
|
print('')
|
||||||
draw_graph(f, v, results['functions'][f]['ifuncs'], graph_res)
|
|
||||||
|
if graph:
|
||||||
|
draw_graph(f, v, results['functions'][f]['ifuncs'], graph_res)
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
@@ -129,7 +132,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)
|
process_results(results, attrs, base_func, args.graph)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@@ -147,6 +150,8 @@ if __name__ == '__main__':
|
|||||||
# Optional arguments.
|
# Optional arguments.
|
||||||
parser.add_argument('-b', '--base',
|
parser.add_argument('-b', '--base',
|
||||||
help='IFUNC variant to set as baseline.')
|
help='IFUNC variant to set as baseline.')
|
||||||
|
parser.add_argument('-g', '--graph', action='store_true',
|
||||||
|
help='Generate a graph from results.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
Reference in New Issue
Block a user