Chromium Code Reviews| Index: tools/perf/metrics/timeline_based_metric.py |
| diff --git a/tools/perf/metrics/timeline_based_metric.py b/tools/perf/metrics/timeline_based_metric.py |
| index 781c61f666639e3c2be566edc12b22798b8fd32c..bb6e169fe5d69304ea965b69f64ef08aaf6b92ca 100644 |
| --- a/tools/perf/metrics/timeline_based_metric.py |
| +++ b/tools/perf/metrics/timeline_based_metric.py |
| @@ -2,6 +2,31 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| + |
| +class _ResultsWrapper(object): |
|
nduca
2014/03/07 20:05:56
this class should be in TimelineBasedMeasurement
|
| + def __init__(self, results, interaction_record): |
| + self._results = results |
| + self._interaction_record = interaction_record |
| + |
| + def Add(self, trace_name, units, value, chart_name=None, data_type='default'): |
| + trace_name = self._interaction_record.GetResultNameFor(trace_name) |
| + self._results.Add(trace_name, units, value, chart_name, data_type) |
| + |
| + def AddSummary(self, trace_name, units, value, chart_name=None, |
| + data_type='default'): |
| + trace_name = self._interaction_record.GetResultNameFor(trace_name) |
| + self._results.AddSummary(trace_name, units, value, chart_name, data_type) |
| + |
| + |
| +def WrapResults(add_results_func): |
| + def WrappedAddResults(self, model, renderer_thread, interaction_record, |
| + results): |
| + wrapped_results = _ResultsWrapper(results, interaction_record) |
| + return add_results_func(self, model, renderer_thread, interaction_record, |
| + wrapped_results) |
| + return WrappedAddResults |
| + |
| + |
| class TimelineBasedMetric(object): |
| def __init__(self): |
| """Computes metrics from a telemetry.core.timeline Model and a range |
| @@ -9,6 +34,7 @@ class TimelineBasedMetric(object): |
| """ |
| super(TimelineBasedMetric, self).__init__() |
| + @WrapResults |
|
nduca
2014/03/07 20:05:56
i'd rather that the measurement construct this wra
|
| def AddResults(self, model, renderer_thread, |
| interaction_record, results): |
| """Computes and adds metrics for the interaction_record's time range. |