| OLD | NEW |
| 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 os.path | 10 import os.path |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 chart_data_recorder = perf_dashboard.ChartDataRecorder( | 190 chart_data_recorder = perf_dashboard.ChartDataRecorder( |
| 191 script_args.test_name) | 191 script_args.test_name) |
| 192 | 192 |
| 193 benchmark_succeeded, benchmark_error, output = _run_benchmark( | 193 benchmark_succeeded, benchmark_error, output = _run_benchmark( |
| 194 shell, shell_args, app, duration, measurements, script_args.verbose, | 194 shell, shell_args, app, duration, measurements, script_args.verbose, |
| 195 script_args.android, output_file) | 195 script_args.android, output_file) |
| 196 | 196 |
| 197 print '[ %s ] %s ' % (benchmark_name, variant_name) | 197 print '[ %s ] %s ' % (benchmark_name, variant_name) |
| 198 | 198 |
| 199 some_measurements_failed = False | 199 some_measurements_failed = False |
| 200 some_measurements_succeeded = False |
| 200 if benchmark_succeeded: | 201 if benchmark_succeeded: |
| 201 measurement_results = _parse_measurement_results(output) | 202 measurement_results = _parse_measurement_results(output) |
| 202 # Iterate over the list of specs, not the dictionary, to detect missing | 203 # Iterate over the list of specs, not the dictionary, to detect missing |
| 203 # results and preserve the required order. | 204 # results and preserve the required order. |
| 204 for measurement in measurements: | 205 for measurement in measurements: |
| 205 if measurement['spec'] in measurement_results: | 206 if measurement['spec'] in measurement_results: |
| 206 result = measurement_results[measurement['spec']] | 207 result = measurement_results[measurement['spec']] |
| 207 print '%10.4f %s' % (result, measurement['name']) | 208 print '%10.4f %s' % (result, measurement['name']) |
| 208 | 209 |
| 209 if chart_data_recorder: | 210 if chart_data_recorder: |
| 210 chart_name = benchmark_name + '__' + variant_name | 211 chart_name = benchmark_name + '__' + variant_name |
| 211 chart_data_recorder.record_scalar( | 212 chart_data_recorder.record_scalar( |
| 212 perf_dashboard.normalize_label(chart_name), | 213 perf_dashboard.normalize_label(chart_name), |
| 213 perf_dashboard.normalize_label(measurement['name']), | 214 perf_dashboard.normalize_label(measurement['name']), |
| 214 'ms', result) | 215 'ms', result) |
| 216 some_measurements_succeeded = True |
| 215 else: | 217 else: |
| 216 print '? %s' % measurement['name'] | 218 print '? %s' % measurement['name'] |
| 217 some_measurements_failed = True | 219 some_measurements_failed = True |
| 218 | 220 |
| 219 if not benchmark_succeeded or some_measurements_failed: | 221 if not benchmark_succeeded or some_measurements_failed: |
| 220 if not benchmark_succeeded: | 222 if not benchmark_succeeded: |
| 221 print 'benchmark failed: ' + benchmark_error | 223 print 'benchmark failed: ' + benchmark_error |
| 222 if some_measurements_failed: | 224 if some_measurements_failed: |
| 223 print 'some measurements failed' | 225 print 'some measurements failed' |
| 224 print 'output: ' | 226 print 'output: ' |
| 225 print '-' * 72 | 227 print '-' * 72 |
| 226 print output | 228 print output |
| 227 print '-' * 72 | 229 print '-' * 72 |
| 228 exit_code = 1 | 230 exit_code = 1 |
| 229 | 231 |
| 230 if script_args.upload: | 232 if script_args.upload and some_measurements_succeeded: |
| 231 if not perf_dashboard.upload_chart_data( | 233 if not perf_dashboard.upload_chart_data( |
| 232 script_args.master_name, script_args.bot_name, | 234 script_args.master_name, script_args.bot_name, |
| 233 script_args.test_name, script_args.builder_name, | 235 script_args.test_name, script_args.builder_name, |
| 234 script_args.build_number, chart_data_recorder.get_chart_data(), | 236 script_args.build_number, chart_data_recorder.get_chart_data(), |
| 235 script_args.server_url, script_args.dry_run): | 237 script_args.server_url, script_args.dry_run): |
| 236 exit_code = 1 | 238 exit_code = 1 |
| 237 | 239 |
| 238 return exit_code | 240 return exit_code |
| 239 | 241 |
| 240 if __name__ == '__main__': | 242 if __name__ == '__main__': |
| 241 sys.exit(main()) | 243 sys.exit(main()) |
| OLD | NEW |