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

Unified Diff: telemetry/telemetry/web_perf/timeline_based_measurement.py

Issue 2110683010: Allow benchmarks to specify running multiple metrics. (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix style some more Created 4 years, 5 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
« no previous file with comments | « no previous file | tracing/bin/run_metric » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/web_perf/timeline_based_measurement.py
diff --git a/telemetry/telemetry/web_perf/timeline_based_measurement.py b/telemetry/telemetry/web_perf/timeline_based_measurement.py
index 78103823d1c2511fbb3ca7af5acf280951a4e82b..aae14f16b830a41f25865c294a124f259e553ac1 100644
--- a/telemetry/telemetry/web_perf/timeline_based_measurement.py
+++ b/telemetry/telemetry/web_perf/timeline_based_measurement.py
@@ -190,7 +190,7 @@ class Options(object):
"object or valid overhead level string. Given overhead "
"level: %s" % overhead_level)
- self._timeline_based_metric = None
+ self._timeline_based_metrics = None
self._legacy_timeline_based_metrics = []
@@ -208,20 +208,28 @@ class Options(object):
return self._config
def SetTimelineBasedMetric(self, metric):
- """Sets the new-style (TBMv2) metric to run.
+ # TODO: delete this convenience method and replace calls to this method
+ # with calls to SetTimelineBasedMetrics
+ self.SetTimelineBasedMetrics([metric])
- Metrics are assumed to live in //tracing/tracing/metrics, so the path
- should be relative to that. For example, to specify sample_metric.html,
- you would pass 'sample_metric.html'.
+ def SetTimelineBasedMetrics(self, metrics):
+ """Sets the new-style (TBMv2) metrics to run.
+
+ Metrics are assumed to live in //tracing/tracing/metrics, so the path you
+ pass in should be relative to that. For example, to specify
+ sample_metric.html, you should pass in ['sample_metric.html'].
Args:
- metric: A string metric path under //tracing/tracing/metrics.
+ metrics: A list of strings giving metric paths under
+ //tracing/tracing/metrics.
"""
- assert isinstance(metric, basestring)
- self._timeline_based_metric = metric
+ assert isinstance(metrics, list)
+ for metric in metrics:
+ assert isinstance(metric, basestring)
+ self._timeline_based_metrics = metrics
- def GetTimelineBasedMetric(self):
- return self._timeline_based_metric
+ def GetTimelineBasedMetrics(self):
+ return self._timeline_based_metrics
def SetLegacyTimelineBasedMetrics(self, metrics):
assert isinstance(metrics, collections.Iterable)
@@ -279,8 +287,8 @@ class TimelineBasedMeasurement(story_test.StoryTest):
trace_value = trace.TraceValue(results.current_page, trace_result)
results.AddValue(trace_value)
- if self._tbm_options.GetTimelineBasedMetric():
- self._ComputeTimelineBasedMetric(results, trace_value)
+ if self._tbm_options.GetTimelineBasedMetrics():
+ self._ComputeTimelineBasedMetrics(results, trace_value)
# Legacy metrics can be computed, but only if explicitly specified.
if self._tbm_options.GetLegacyTimelineBasedMetrics():
self._ComputeLegacyTimelineBasedMetrics(results, trace_result)
@@ -299,14 +307,14 @@ class TimelineBasedMeasurement(story_test.StoryTest):
if platform.tracing_controller.is_tracing_running:
platform.tracing_controller.StopTracing()
- def _ComputeTimelineBasedMetric(self, results, trace_value):
- metric = self._tbm_options.GetTimelineBasedMetric()
+ def _ComputeTimelineBasedMetrics(self, results, trace_value):
+ metrics = self._tbm_options.GetTimelineBasedMetrics()
extra_import_options = {
'trackDetailedModelStats': True
}
mre_result = metric_runner.RunMetric(
- trace_value.filename, metric, extra_import_options)
+ trace_value.filename, metrics, extra_import_options)
page = results.current_page
failure_dicts = mre_result.failures
« no previous file with comments | « no previous file | tracing/bin/run_metric » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698