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

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

Issue 414253004: Introduce TracingController and TracingControllerBackend skeleton (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready_to_land 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 unified diff | Download patch | Annotate | Revision Log
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.platform import tracing_category_filter
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 = None
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 SetUp(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 category_filter = tracing_category_filter.TracingCategoryFilter(
34 categories = [self.trace_categories] + \ 34 filter_string=self.trace_categories)
35 page.GetSyntheticDelayCategories() 35 for delay in page.GetSyntheticDelayCategories():
36 else: 36 category_filter.AddSyntheticDelay(delay)
37 categories = page.GetSyntheticDelayCategories() 37 tab.browser.StartTracing(category_filter)
38 tab.browser.StartTracing(','.join(categories))
39 38
40 def Start(self, tab): 39 def Start(self, tab):
41 # Start the smooth marker for all actions. 40 # Start the smooth marker for all actions.
42 runner = action_runner.ActionRunner(tab) 41 runner = action_runner.ActionRunner(tab)
43 self._interaction = runner.BeginInteraction( 42 self._interaction = runner.BeginInteraction(
44 RUN_SMOOTH_ACTIONS, is_smooth=True) 43 RUN_SMOOTH_ACTIONS, is_smooth=True)
45 44
46 def Stop(self, tab): 45 def Stop(self, tab):
47 # End the smooth marker for all actions. 46 # End the smooth marker for all actions.
48 self._interaction.End() 47 self._interaction.End()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 def model(self): 83 def model(self):
85 return self._model 84 return self._model
86 85
87 @property 86 @property
88 def renderer_process(self): 87 def renderer_process(self):
89 return self._renderer_process 88 return self._renderer_process
90 89
91 @property 90 @property
92 def smooth_records(self): 91 def smooth_records(self):
93 return self._smooth_records 92 return self._smooth_records
OLDNEW
« no previous file with comments | « tools/perf/measurements/thread_times.py ('k') | tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698