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

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

Issue 2142293002: [Telemetry] Also merge across tir_labels for TBM (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Fix failing tests Created 4 years, 4 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 6
6 class OutputFormatter(object): 7 class OutputFormatter(object):
7 """A formatter for PageTestResults. 8 """A formatter for PageTestResults.
8 9
9 An OutputFormatter takes PageTestResults, formats the results 10 An OutputFormatter takes PageTestResults, formats the results
10 (telemetry.value.Value instances), and output the formatted results 11 (telemetry.value.Value instances), and output the formatted results
11 in the given output stream. 12 in the given output stream.
12 13
13 Examples of output formatter: CsvOutputFormatter produces results in 14 Examples of output formatter: CsvOutputFormatter produces results in
14 CSV format.""" 15 CSV format."""
(...skipping 13 matching lines...) Expand all
28 29
29 Args: 30 Args:
30 page_test_results: A PageTestResults object containing all results 31 page_test_results: A PageTestResults object containing all results
31 from the current benchmark run. 32 from the current benchmark run.
32 """ 33 """
33 raise NotImplementedError() 34 raise NotImplementedError()
34 35
35 @property 36 @property
36 def output_stream(self): 37 def output_stream(self):
37 return self._output_stream 38 return self._output_stream
39
40
41 def SummarizePageSpecificValues(page_specific_values):
42 """Summarize results appropriately for TBM and legacy benchmarks.
43
44 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
46 benchmarks that are not timeline-based, since no tir_labels are set, we will
47 end up duplicating values.
48
49 Thus, we only want to summarize once if the benchmark is not timeline-based,
50 but twice, using the two different key functions, otherwise.
51 """
52 # Default summary uses merge_values.DefaultKeyFunc to summarize both by name
53 # and tir_label.
54 summary = summary_module.Summary(page_specific_values)
55 values = summary.interleaved_computed_per_page_values_and_summaries
56
57 if any(v.tir_label for v in page_specific_values):
58 summary_by_name_only = summary_module.Summary(
59 page_specific_values,
60 key_func=lambda v: v.name)
61 values.extend(
62 summary_by_name_only.interleaved_computed_per_page_values_and_summaries
63 )
64 return values
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/results/chart_json_output_formatter.py ('k') | telemetry/telemetry/value/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698