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

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

Issue 165673008: [telemetry] Implement first version of timeline based measurement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: With feedback and naming updates Created 6 years, 10 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
new file mode 100644
index 0000000000000000000000000000000000000000..3ec90025ae25b300abe0d9c4b05c3ef362b5d41d
--- /dev/null
+++ b/tools/perf/metrics/timeline_interaction_record.py
@@ -0,0 +1,38 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+
+
+def IsTimelineInteractionRecord(event_name):
+ return event_name.startswith('Interaction.')
+
+
+class TimelineInteractionRecord(object):
+ def __init__(self, event):
+ self.start = event.start
+ self.end = event.end
+
+ m = re.match('Interaction\.(.+)\/(.+)', event.name)
+ if m:
+ self.logical_name = m.group(1)
+ if m.group(1) != '':
+ flags = m.group(2).split(',')
+ else:
+ flags = []
+ else:
+ m = re.match('Interaction\.(.+)', event.name)
+ assert m
+ self.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
+
+ def GetResultNameFor(self, result_name):
+ return "%s/%s" % (self.logical_name, result_name)

Powered by Google App Engine
This is Rietveld 408576698