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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/results/output_formatter.py
diff --git a/telemetry/telemetry/internal/results/output_formatter.py b/telemetry/telemetry/internal/results/output_formatter.py
index 62262326392c559b344da3c6f519dd87d72ecc10..644b01664c8e8ae935b6f18867a5acb76fa0d500 100644
--- a/telemetry/telemetry/internal/results/output_formatter.py
+++ b/telemetry/telemetry/internal/results/output_formatter.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from telemetry.value import summary as summary_module
class OutputFormatter(object):
"""A formatter for PageTestResults.
@@ -35,3 +36,29 @@ class OutputFormatter(object):
@property
def output_stream(self):
return self._output_stream
+
+
+def SummarizePageSpecificValues(page_specific_values):
+ """Summarize results appropriately for TBM and legacy benchmarks.
+
+ For benchmarks that are timeline-based, we need to summarize not once, but
+ twice, once by name and tir_label (default) and again by name only. But for
+ benchmarks that are not timeline-based, since no tir_labels are set, we will
+ end up duplicating values.
+
+ Thus, we only want to summarize once if the benchmark is not timeline-based,
+ but twice, using the two different key functions, otherwise.
+ """
+ # Default summary uses merge_values.DefaultKeyFunc to summarize both by name
+ # and tir_label.
+ summary = summary_module.Summary(page_specific_values)
+ values = summary.interleaved_computed_per_page_values_and_summaries
+
+ if any(v.tir_label for v in page_specific_values):
+ summary_by_name_only = summary_module.Summary(
+ page_specific_values,
+ key_func=lambda v: v.name)
+ values.extend(
+ summary_by_name_only.interleaved_computed_per_page_values_and_summaries
+ )
+ return values
« 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