about summary refs log tree commit diff
path: root/benchtests
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2017-09-16 15:23:59 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2017-09-16 15:24:00 +0530
commit140647ea6fee9c08c67b4130e9f9e8dc7a646a3e (patch)
tree967c945f1f8c1cac6c6c23ba713d16e1b1408699 /benchtests
parent5a6547b7b9e8174a2aa228c4d3c5de7245f720b6 (diff)
downloadglibc-140647ea6fee9c08c67b4130e9f9e8dc7a646a3e.tar.gz
glibc-140647ea6fee9c08c67b4130e9f9e8dc7a646a3e.tar.xz
glibc-140647ea6fee9c08c67b4130e9f9e8dc7a646a3e.zip
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.
Diffstat (limited to 'benchtests')
-rwxr-xr-xbenchtests/scripts/compare_strings.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/benchtests/scripts/compare_strings.py b/benchtests/scripts/compare_strings.py
index 1f0be3b981..65119edd64 100755
--- a/benchtests/scripts/compare_strings.py
+++ b/benchtests/scripts/compare_strings.py
@@ -57,6 +57,7 @@ def draw_graph(f, v, ifuncs, results):
         ifuncs: List of ifunc names
         results: Dictionary of results for each test criterion
     """
+    print('Generating graph for %s, variant \'%s\'' % (f, v))
     xkeys = results.keys()
 
     pylab.clf()
@@ -78,7 +79,7 @@ def draw_graph(f, v, ifuncs, results):
     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
 
     Args:
@@ -113,7 +114,9 @@ def process_results(results, attrs, base_func):
                 sys.stdout.write('\t')
                 i = i + 1
             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):
@@ -129,7 +132,7 @@ def main(args):
     attrs = args.attributes.split(',')
 
     results = parse_file(args.input, args.schema)
-    process_results(results, attrs, base_func)
+    process_results(results, attrs, base_func, args.graph)
 
 
 if __name__ == '__main__':
@@ -147,6 +150,8 @@ if __name__ == '__main__':
     # Optional arguments.
     parser.add_argument('-b', '--base',
                         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()
     main(args)