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

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

Issue 170183004: Move smoothness to the new API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit
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..3912dd60b1142b64fee467fff0f4e9b7726b68fe 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, start, end):
+ self.start = start
nduca 2014/03/07 20:05:56 i'd like logical_name to be mandatory
+ self.end = end
+ self.logical_name = ''
+ self.is_smooth = False
+ self.is_loading_resources = False
+ @staticmethod
+ def FromEvent(event):
+ record = TimelineInteractionRecord(event.start, event.end)
m = re.match('Interaction\.(.+)\/(.+)', event.name)
if m:
- self.logical_name = m.group(1)
+ record.logical_name = m.group(1)
if m.group(1) != '':
flags = m.group(2).split(',')
else:
@@ -60,15 +66,24 @@ class TimelineInteractionRecord(object):
else:
m = re.match('Interaction\.(.+)', event.name)
assert m
- self.logical_name = m.group(1)
+ record.logical_name = m.group(1)
flags = []
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
+
+ @staticmethod
+ def FromBounds(bounds):
nduca 2014/03/07 20:05:56 logical name is required
+ record = TimelineInteractionRecord(bounds.min, bounds.max)
+ return record
def GetResultNameFor(self, result_name):
- return "%s/%s" % (self.logical_name, result_name)
+ if self.logical_name:
+ return "%s-%s" % (self.logical_name, result_name)
+ else:
+ return result_name

Powered by Google App Engine
This is Rietveld 408576698