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

Side by Side Diff: tools/perf/measurements/timeline_controller.py

Issue 392613002: Telemetry: Initialize smoothness and thread_times metrics before page load, not after. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split Start into SetUp and Start for smoothness and timeline controller. Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/thread_times.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 from measurements import smooth_gesture_util 4 from measurements import smooth_gesture_util
5 5
6 from telemetry.core.backends.chrome import tracing_backend 6 from telemetry.core.backends.chrome import tracing_backend
7 from telemetry.timeline.model import TimelineModel 7 from telemetry.timeline.model import TimelineModel
8 from telemetry.page.actions import action_runner 8 from telemetry.page.actions import action_runner
9 from telemetry.web_perf import timeline_interaction_record as tir_module 9 from telemetry.web_perf import timeline_interaction_record as tir_module
10 10
11 11
12 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' 12 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions'
13 13
14 14
15 class TimelineController(object): 15 class TimelineController(object):
16 def __init__(self): 16 def __init__(self):
17 super(TimelineController, self).__init__() 17 super(TimelineController, self).__init__()
18 self.trace_categories = tracing_backend.DEFAULT_TRACE_CATEGORIES 18 self.trace_categories = tracing_backend.DEFAULT_TRACE_CATEGORIES
19 self._model = None 19 self._model = None
20 self._renderer_process = None 20 self._renderer_process = None
21 self._smooth_records = [] 21 self._smooth_records = []
22 self._interaction = None 22 self._interaction = None
23 23
24 def Start(self, page, tab): 24 def SetUp(self, page, tab):
25 """Starts gathering timeline data. 25 """Starts gathering timeline data.
26 26
27 """ 27 """
28 # Resets these member variables incase this object is reused. 28 # Resets these member variables incase this object is reused.
29 self._model = None 29 self._model = None
30 self._renderer_process = None 30 self._renderer_process = None
31 if not tab.browser.supports_tracing: 31 if not tab.browser.supports_tracing:
32 raise Exception('Not supported') 32 raise Exception('Not supported')
33 if self.trace_categories: 33 if self.trace_categories:
34 categories = [self.trace_categories] + \ 34 categories = [self.trace_categories] + \
35 page.GetSyntheticDelayCategories() 35 page.GetSyntheticDelayCategories()
36 else: 36 else:
37 categories = page.GetSyntheticDelayCategories() 37 categories = page.GetSyntheticDelayCategories()
38 tab.browser.StartTracing(','.join(categories)) 38 tab.browser.StartTracing(','.join(categories))
39
40 def Start(self, tab):
39 # Start the smooth marker for all actions. 41 # Start the smooth marker for all actions.
40 runner = action_runner.ActionRunner(tab) 42 runner = action_runner.ActionRunner(tab)
41 self._interaction = runner.BeginInteraction( 43 self._interaction = runner.BeginInteraction(
42 RUN_SMOOTH_ACTIONS, is_smooth=True) 44 RUN_SMOOTH_ACTIONS, is_smooth=True)
43 45
44 def Stop(self, tab): 46 def Stop(self, tab):
45 # End the smooth marker for all actions. 47 # End the smooth marker for all actions.
46 self._interaction.End() 48 self._interaction.End()
47 # Stop tracing. 49 # Stop tracing.
48 timeline_data = tab.browser.StopTracing() 50 timeline_data = tab.browser.StopTracing()
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 def model(self): 84 def model(self):
83 return self._model 85 return self._model
84 86
85 @property 87 @property
86 def renderer_process(self): 88 def renderer_process(self):
87 return self._renderer_process 89 return self._renderer_process
88 90
89 @property 91 @property
90 def smooth_records(self): 92 def smooth_records(self):
91 return self._smooth_records 93 return self._smooth_records
OLDNEW
« no previous file with comments | « tools/perf/measurements/thread_times.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698