Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: mojo/devtools/common/mojo_benchmark

Issue 1442623002: Improve presentation of aggregate results in mojo_benchmark. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runner for Mojo application benchmarks.""" 6 """Runner for Mojo application benchmarks."""
7 7
8 import argparse 8 import argparse
9 import logging 9 import logging
10 import numpy
10 import sys 11 import sys
11 import time 12 import time
12 13
13 from devtoolslib import benchmark 14 from devtoolslib import benchmark
14 from devtoolslib import perf_dashboard 15 from devtoolslib import perf_dashboard
15 from devtoolslib import shell_arguments 16 from devtoolslib import shell_arguments
16 from devtoolslib import shell_config 17 from devtoolslib import shell_config
17 18
18 19
19 _DESCRIPTION = """Runner for Mojo application benchmarks. 20 _DESCRIPTION = """Runner for Mojo application benchmarks.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if not outcome.succeeded: 64 if not outcome.succeeded:
64 print 'benchmark failed: ' + outcome.error_str 65 print 'benchmark failed: ' + outcome.error_str
65 if outcome.some_measurements_failed: 66 if outcome.some_measurements_failed:
66 print 'some measurements failed' 67 print 'some measurements failed'
67 print 'output: ' 68 print 'output: '
68 print '-' * 72 69 print '-' * 72
69 print outcome.output 70 print outcome.output
70 print '-' * 72 71 print '-' * 72
71 72
72 73
74 def _format_vector(results):
75 if not len(results):
76 return "med -, avg -, std-dev -, (no results)"
77
78 return "med %f, avg %f, std-dev %f %s" % (numpy.median(results),
79 numpy.mean(results),
80 numpy.std(results),
81 str(results))
82
83
73 def _print_results(benchmark_name, variant_name, results, measurements, 84 def _print_results(benchmark_name, variant_name, results, measurements,
74 aggregate): 85 aggregate):
75 print '[ %s ] %s ' % (benchmark_name, variant_name) 86 print '[ %s ] %s ' % (benchmark_name, variant_name)
76 for measurement in measurements: 87 for measurement in measurements:
77 print ' ' + measurement['name'] + ': ', 88 print ' ' + measurement['name'] + ': ',
78 if measurement['spec'] in results: 89 if measurement['spec'] in results:
79 if aggregate: 90 if aggregate:
80 print str(results[measurement['spec']]) 91 print _format_vector(results[measurement['spec']])
81 else: 92 else:
82 if len(results[measurement['spec']]) == 0: 93 if len(results[measurement['spec']]) == 0:
83 print '?' 94 print '?'
84 else: 95 else:
85 print '%f' % results[measurement['spec']][0] 96 print '%f' % results[measurement['spec']][0]
86 else: 97 else:
87 print '?' 98 print '?'
88 99
89 100
90 def _upload_results(benchmark_name, variant_name, results, measurements, 101 def _upload_results(benchmark_name, variant_name, results, measurements,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 variant_results[variant_name], 222 variant_results[variant_name],
212 variant_spec['measurements'], 223 variant_spec['measurements'],
213 script_args) 224 script_args)
214 if not upload_succeeded: 225 if not upload_succeeded:
215 exit_code = 1 226 exit_code = 1
216 227
217 return exit_code 228 return exit_code
218 229
219 if __name__ == '__main__': 230 if __name__ == '__main__':
220 sys.exit(main()) 231 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698