Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import codecs | 5 import codecs |
| 6 import optparse | 6 import optparse |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 return open(output_file, mode='w+') | 105 return open(output_file, mode='w+') |
| 106 | 106 |
| 107 | 107 |
| 108 def _GetProgressReporter(output_skipped_tests_summary, suppress_gtest_report): | 108 def _GetProgressReporter(output_skipped_tests_summary, suppress_gtest_report): |
| 109 if suppress_gtest_report: | 109 if suppress_gtest_report: |
| 110 return progress_reporter.ProgressReporter() | 110 return progress_reporter.ProgressReporter() |
| 111 | 111 |
| 112 return gtest_progress_reporter.GTestProgressReporter( | 112 return gtest_progress_reporter.GTestProgressReporter( |
| 113 sys.stdout, output_skipped_tests_summary=output_skipped_tests_summary) | 113 sys.stdout, output_skipped_tests_summary=output_skipped_tests_summary) |
| 114 | 114 |
| 115 def FormatDisabledResults(benchmark_metadata, options): | |
| 116 if not options.output_formats: | |
| 117 # We only output disabled results for chartjson | |
| 118 return | |
| 119 | |
| 120 if 'chartjson' in options.output_formats: | |
|
nednguyen
2016/09/22 13:24:33
We should use polymorphism to handle this instead
eyaich1
2016/09/26 14:23:09
Done.
| |
| 121 output_stream = _GetOutputStream('chartjson', options.output_dir) | |
| 122 chart_json_output_formatter.ChartJsonOutputFormatter( | |
| 123 output_stream, benchmark_metadata).FormatDisabled() | |
| 115 | 124 |
| 116 def CreateResults(benchmark_metadata, options, | 125 def CreateResults(benchmark_metadata, options, |
| 117 value_can_be_added_predicate=lambda v, is_first: True): | 126 value_can_be_added_predicate=lambda v, is_first: True): |
| 118 """ | 127 """ |
| 119 Args: | 128 Args: |
| 120 options: Contains the options specified in AddResultsOptions. | 129 options: Contains the options specified in AddResultsOptions. |
| 121 """ | 130 """ |
| 122 if not options.output_formats: | 131 if not options.output_formats: |
| 123 options.output_formats = [_OUTPUT_FORMAT_CHOICES[0]] | 132 options.output_formats = [_OUTPUT_FORMAT_CHOICES[0]] |
| 124 | 133 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 output_formatters=output_formatters, progress_reporter=reporter, | 177 output_formatters=output_formatters, progress_reporter=reporter, |
| 169 output_dir=options.output_dir, | 178 output_dir=options.output_dir, |
| 170 value_can_be_added_predicate=value_can_be_added_predicate) | 179 value_can_be_added_predicate=value_can_be_added_predicate) |
| 171 | 180 |
| 172 results.iteration_info.benchmark_name = benchmark_metadata.name | 181 results.iteration_info.benchmark_name = benchmark_metadata.name |
| 173 results.iteration_info.benchmark_start_ms = time.time() * 1000.0 | 182 results.iteration_info.benchmark_start_ms = time.time() * 1000.0 |
| 174 if options.results_label: | 183 if options.results_label: |
| 175 results.iteration_info.label = options.results_label | 184 results.iteration_info.label = options.results_label |
| 176 | 185 |
| 177 return results | 186 return results |
| OLD | NEW |