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

Side by Side Diff: telemetry/telemetry/internal/results/output_formatter.py

Issue 2342023005: Outputting chart json for disabled tests. (Closed)
Patch Set: Chaing the right json_output_formatter Created 4 years, 2 months 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
OLDNEW
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 from telemetry.value import summary as summary_module 5 from telemetry.value import summary as summary_module
6 6
7 class OutputFormatter(object): 7 class OutputFormatter(object):
8 """A formatter for PageTestResults. 8 """A formatter for PageTestResults.
9 9
10 An OutputFormatter takes PageTestResults, formats the results 10 An OutputFormatter takes PageTestResults, formats the results
(...skipping 15 matching lines...) Expand all
26 """Formats the given PageTestResults into the output stream. 26 """Formats the given PageTestResults into the output stream.
27 27
28 This will be called once at the end of a benchmark. 28 This will be called once at the end of a benchmark.
29 29
30 Args: 30 Args:
31 page_test_results: A PageTestResults object containing all results 31 page_test_results: A PageTestResults object containing all results
32 from the current benchmark run. 32 from the current benchmark run.
33 """ 33 """
34 raise NotImplementedError() 34 raise NotImplementedError()
35 35
36 def FormatDisabled(self):
37 """Formats disabled results into the output stream.
38
39 This will be called once when a benchmark is run but disabled.
40 """
41 raise NotImplementedError()
perezju 2016/09/26 14:42:35 nit: I would let this one be "pass" as the default
eyaich1 2016/09/26 15:26:54 Done.
42
36 @property 43 @property
37 def output_stream(self): 44 def output_stream(self):
38 return self._output_stream 45 return self._output_stream
39 46
40 47
41 def SummarizePageSpecificValues(page_specific_values): 48 def SummarizePageSpecificValues(page_specific_values):
42 """Summarize results appropriately for TBM and legacy benchmarks. 49 """Summarize results appropriately for TBM and legacy benchmarks.
43 50
44 For benchmarks that are timeline-based, we need to summarize not once, but 51 For benchmarks that are timeline-based, we need to summarize not once, but
45 twice, once by name and tir_label (default) and again by name only. But for 52 twice, once by name and tir_label (default) and again by name only. But for
46 benchmarks that are not timeline-based, since no tir_labels are set, we will 53 benchmarks that are not timeline-based, since no tir_labels are set, we will
47 end up duplicating values. 54 end up duplicating values.
48 55
49 Thus, we only want to summarize once if the benchmark is not timeline-based, 56 Thus, we only want to summarize once if the benchmark is not timeline-based,
50 but twice, using the two different key functions, otherwise. 57 but twice, using the two different key functions, otherwise.
51 """ 58 """
52 # Default summary uses merge_values.DefaultKeyFunc to summarize both by name 59 # Default summary uses merge_values.DefaultKeyFunc to summarize both by name
53 # and tir_label. 60 # and tir_label.
54 summary = summary_module.Summary(page_specific_values) 61 summary = summary_module.Summary(page_specific_values)
55 values = summary.interleaved_computed_per_page_values_and_summaries 62 values = summary.interleaved_computed_per_page_values_and_summaries
56 63
57 if any(v.tir_label for v in page_specific_values): 64 if any(v.tir_label for v in page_specific_values):
58 summary_by_name_only = summary_module.Summary( 65 summary_by_name_only = summary_module.Summary(
59 page_specific_values, 66 page_specific_values,
60 key_func=lambda v: v.name) 67 key_func=lambda v: v.name)
61 values.extend( 68 values.extend(
62 summary_by_name_only.interleaved_computed_per_page_values_and_summaries 69 summary_by_name_only.interleaved_computed_per_page_values_and_summaries
63 ) 70 )
64 return values 71 return values
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698