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 collections | 5 import collections |
6 import itertools | 6 import itertools |
7 import json | 7 import json |
8 | 8 |
9 from telemetry.results import output_formatter | 9 from telemetry.results import output_formatter |
10 from telemetry.value import summary as summary_module | 10 from telemetry.value import summary as summary_module |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 # This intentionally overwrites the trace if it already exists because this | 48 # This intentionally overwrites the trace if it already exists because this |
49 # is expected of output from the buildbots currently. | 49 # is expected of output from the buildbots currently. |
50 # See: crbug.com/413393 | 50 # See: crbug.com/413393 |
51 charts[chart_name][trace_name] = value.AsDict() | 51 charts[chart_name][trace_name] = value.AsDict() |
52 | 52 |
53 result_dict = { | 53 result_dict = { |
54 'format_version': '0.1', | 54 'format_version': '0.1', |
55 'benchmark_name': benchmark_metadata.name, | 55 'benchmark_name': benchmark_metadata.name, |
56 'benchmark_description': benchmark_metadata.description, | 56 'benchmark_description': benchmark_metadata.description, |
57 'benchmark_rerun_options': benchmark_metadata.rerun_options, | 57 'trace_rerun_options': benchmark_metadata.rerun_options, |
58 'charts': charts, | 58 'charts': charts, |
59 } | 59 } |
60 | 60 |
61 return result_dict | 61 return result_dict |
62 | 62 |
63 # TODO(eakuefner): Transition this to translate Telemetry JSON. | 63 # TODO(eakuefner): Transition this to translate Telemetry JSON. |
64 class ChartJsonOutputFormatter(output_formatter.OutputFormatter): | 64 class ChartJsonOutputFormatter(output_formatter.OutputFormatter): |
65 def __init__(self, output_stream, benchmark_metadata): | 65 def __init__(self, output_stream, benchmark_metadata): |
66 super(ChartJsonOutputFormatter, self).__init__(output_stream) | 66 super(ChartJsonOutputFormatter, self).__init__(output_stream) |
67 self._benchmark_metadata = benchmark_metadata | 67 self._benchmark_metadata = benchmark_metadata |
68 | 68 |
69 def Format(self, page_test_results): | 69 def Format(self, page_test_results): |
70 json.dump(_ResultsAsChartDict( | 70 json.dump(_ResultsAsChartDict( |
71 self._benchmark_metadata, | 71 self._benchmark_metadata, |
72 page_test_results.all_page_specific_values, | 72 page_test_results.all_page_specific_values, |
73 page_test_results.all_summary_values), | 73 page_test_results.all_summary_values), |
74 self.output_stream, indent=2) | 74 self.output_stream, indent=2) |
75 self.output_stream.write('\n') | 75 self.output_stream.write('\n') |
OLD | NEW |