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

Unified Diff: tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py

Issue 439383002: Add GetThreadToInteractionRecordsMapsFromModel method to timeline_interaction_record. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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: 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.')

Powered by Google App Engine
This is Rietveld 408576698