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

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

Issue 1013803003: [Telemetry] Remove is_smooth flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failing test Created 5 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 unified diff | Download patch
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.platform import tracing_category_filter 6 from telemetry.core.platform import tracing_category_filter
7 from telemetry.core.platform import tracing_options 7 from telemetry.core.platform import tracing_options
8 from telemetry.timeline.model import TimelineModel 8 from telemetry.timeline.model import TimelineModel
9 from telemetry.page.actions import action_runner 9 from telemetry.page.actions import action_runner
10 from telemetry.value import trace 10 from telemetry.value import trace
(...skipping 26 matching lines...) Expand all
37 for delay in page.GetSyntheticDelayCategories(): 37 for delay in page.GetSyntheticDelayCategories():
38 category_filter.AddSyntheticDelay(delay) 38 category_filter.AddSyntheticDelay(delay)
39 options = tracing_options.TracingOptions() 39 options = tracing_options.TracingOptions()
40 options.enable_chrome_trace = True 40 options.enable_chrome_trace = True
41 tab.browser.platform.tracing_controller.Start(options, category_filter) 41 tab.browser.platform.tracing_controller.Start(options, category_filter)
42 42
43 def Start(self, tab): 43 def Start(self, tab):
44 # Start the smooth marker for all actions. 44 # Start the smooth marker for all actions.
45 runner = action_runner.ActionRunner(tab) 45 runner = action_runner.ActionRunner(tab)
46 self._interaction = runner.BeginInteraction( 46 self._interaction = runner.BeginInteraction(
47 RUN_SMOOTH_ACTIONS, is_smooth=True) 47 RUN_SMOOTH_ACTIONS)
48 48
49 def Stop(self, tab, results): 49 def Stop(self, tab, results):
50 # End the smooth marker for all actions. 50 # End the smooth marker for all actions.
51 self._interaction.End() 51 self._interaction.End()
52 # Stop tracing. 52 # Stop tracing.
53 timeline_data = tab.browser.platform.tracing_controller.Stop() 53 timeline_data = tab.browser.platform.tracing_controller.Stop()
54 results.AddValue(trace.TraceValue( 54 results.AddValue(trace.TraceValue(
55 results.current_page, timeline_data)) 55 results.current_page, timeline_data))
56 self._model = TimelineModel(timeline_data) 56 self._model = TimelineModel(timeline_data)
57 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) 57 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id)
58 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id) 58 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id)
59 59
60 run_smooth_actions_record = None 60 run_smooth_actions_record = None
61 self._smooth_records = [] 61 self._smooth_records = []
62 for event in renderer_thread.async_slices: 62 for event in renderer_thread.async_slices:
63 if not tir_module.IsTimelineInteractionRecord(event.name): 63 if not tir_module.IsTimelineInteractionRecord(event.name):
64 continue 64 continue
65 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event) 65 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event)
66 if r.label == RUN_SMOOTH_ACTIONS: 66 if r.label == RUN_SMOOTH_ACTIONS:
67 assert run_smooth_actions_record is None, ( 67 assert run_smooth_actions_record is None, (
68 'TimelineController cannot issue more than 1 %s record' % 68 'TimelineController cannot issue more than 1 %s record' %
69 RUN_SMOOTH_ACTIONS) 69 RUN_SMOOTH_ACTIONS)
70 run_smooth_actions_record = r 70 run_smooth_actions_record = r
71 elif r.is_smooth: 71 else:
72 self._smooth_records.append( 72 self._smooth_records.append(
73 smooth_gesture_util.GetAdjustedInteractionIfContainGesture( 73 smooth_gesture_util.GetAdjustedInteractionIfContainGesture(
74 self.model, r)) 74 self.model, r))
75 75
76 # If there is no other smooth records, we make measurements on time range 76 # If there is no other smooth records, we make measurements on time range
77 # marked by timeline_controller itself. 77 # marked by timeline_controller itself.
78 # TODO(nednguyen): when crbug.com/239179 is marked fixed, makes sure that 78 # TODO(nednguyen): when crbug.com/239179 is marked fixed, makes sure that
79 # page sets are responsible for issueing the markers themselves. 79 # page sets are responsible for issueing the markers themselves.
80 if len(self._smooth_records) == 0 and run_smooth_actions_record: 80 if len(self._smooth_records) == 0 and run_smooth_actions_record:
81 self._smooth_records = [run_smooth_actions_record] 81 self._smooth_records = [run_smooth_actions_record]
82 82
83 83
84 def CleanUp(self, tab): 84 def CleanUp(self, tab):
85 if tab.browser.platform.tracing_controller.is_tracing_running: 85 if tab.browser.platform.tracing_controller.is_tracing_running:
86 tab.browser.platform.tracing_controller.Stop() 86 tab.browser.platform.tracing_controller.Stop()
87 87
88 @property 88 @property
89 def model(self): 89 def model(self):
90 return self._model 90 return self._model
91 91
92 @property 92 @property
93 def renderer_process(self): 93 def renderer_process(self):
94 return self._renderer_process 94 return self._renderer_process
95 95
96 @property 96 @property
97 def smooth_records(self): 97 def smooth_records(self):
98 return self._smooth_records 98 return self._smooth_records
OLDNEW
« no previous file with comments | « tools/perf/measurements/task_execution_time_unittest.py ('k') | tools/perf/page_sets/alexa1-10000.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698