Index: tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py |
diff --git a/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py b/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py |
index f406b12c1403169a175c9b550506c219cb5c6f00..38f11518c69d594f2447bd195a232133d78d09b9 100644 |
--- a/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py |
+++ b/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py |
@@ -34,7 +34,7 @@ class TimelineBasedMetric(object): |
""" |
super(TimelineBasedMetric, self).__init__() |
- def AddResults(self, model, renderer_thread, interaction_records, results): |
+ def AddResults(self, model, interaction_records, results): |
"""Computes and adds metrics for the interaction_records' time ranges. |
The override of this method should compute results on the data **only** |
@@ -51,9 +51,23 @@ class TimelineBasedMetric(object): |
raise NotImplementedError() |
def VerifyNonOverlappedRecords(self, interaction_records): |
- """This raises exceptions if interaction_records contain overlapped ranges. |
+ """This raises exception if interaction_records contain overlapped ranges. |
""" |
if _TimeRangesHasOverlap(((r.start, r.end) for r in interaction_records)): |
raise TimelineBasedMetricException( |
'This metric does not support interaction records with overlapped ' |
'time range.') |
+ |
+ def VerifyAllRecordsIssuedBySameThread(self, interaction_records): |
+ """This raises exception if interaction records are not issued by the same |
+ thread. |
+ """ |
+ assert interaction_records[0].async_event |
+ first_record_start_thread = interaction_records[0].async_event.start_thread |
+ assert first_record_start_thread |
+ for r in interaction_records: |
+ if (r.async_event.start_thread is not first_record_start_thread or |
+ r.async_event.end_thread is not first_record_start_thread): |
+ raise TimelineBasedMetricException( |
+ 'This metric does not support interaction records that are not ' |
+ 'issued by a same thread.') |