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

Unified Diff: tools/perf/metrics/timeline_interaction_record.py

Issue 200843002: Convert smoothness to the new timeline based metric API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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/perf/metrics/timeline_interaction_record.py
diff --git a/tools/perf/metrics/timeline_interaction_record.py b/tools/perf/metrics/timeline_interaction_record.py
index 87d575de8beaa9b6d0362c35c807a9e1309b865d..c2da4ad58acc4117c3295f620f603f9b41df25a9 100644
--- a/tools/perf/metrics/timeline_interaction_record.py
+++ b/tools/perf/metrics/timeline_interaction_record.py
@@ -46,13 +46,19 @@ class TimelineInteractionRecord(object):
time-range.
"""
- def __init__(self, event):
- self.start = event.start
- self.end = event.end
+ def __init__(self, logical_name, start, end):
+ assert logical_name
+ self.logical_name = logical_name
+ self.start = start
+ self.end = end
+ self.is_smooth = False
+ self.is_loading_resources = False
+ @staticmethod
+ def FromEvent(event):
m = re.match('Interaction\.(.+)\/(.+)', event.name)
if m:
- self.logical_name = m.group(1)
+ logical_name = m.group(1)
if m.group(1) != '':
flags = m.group(2).split(',')
else:
@@ -60,15 +66,17 @@ class TimelineInteractionRecord(object):
else:
m = re.match('Interaction\.(.+)', event.name)
assert m
- self.logical_name = m.group(1)
+ logical_name = m.group(1)
flags = []
+ record = TimelineInteractionRecord(logical_name, event.start, event.end)
for f in flags:
if not f in ('is_smooth', 'is_loading_resources'):
raise Exception(
'Unrecognized flag in timeline Interaction record: %s' % f)
- self.is_smooth = 'is_smooth' in flags
- self.is_loading_resources = 'is_loading_resources' in flags
+ record.is_smooth = 'is_smooth' in flags
+ record.is_loading_resources = 'is_loading_resources' in flags
+ return record
def GetResultNameFor(self, result_name):
- return "%s/%s" % (self.logical_name, result_name)
+ return "%s-%s" % (self.logical_name, result_name)
« no previous file with comments | « tools/perf/metrics/timeline_based_metric.py ('k') | tools/perf/metrics/timeline_interaction_record_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698