| 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
|
|
|