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

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

Issue 471763003: Remove deprecated methods related to tracing in browser.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 import sys 4 import sys
5 5
6 from measurements import smooth_gesture_util 6 from measurements import smooth_gesture_util
7 from telemetry.core.platform import tracing_category_filter
8 from telemetry.core.platform import tracing_options
7 from telemetry.timeline.model import TimelineModel 9 from telemetry.timeline.model import TimelineModel
8 from telemetry.page import page_test 10 from telemetry.page import page_test
9 from telemetry.page.actions import action_runner 11 from telemetry.page.actions import action_runner
10 from telemetry.value import list_of_scalar_values 12 from telemetry.value import list_of_scalar_values
11 from telemetry.value import scalar 13 from telemetry.value import scalar
12 from telemetry.web_perf import timeline_interaction_record as tir_module 14 from telemetry.web_perf import timeline_interaction_record as tir_module
13 from telemetry.web_perf.metrics import smoothness 15 from telemetry.web_perf.metrics import smoothness
14 16
15 17
16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' 18 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions'
(...skipping 14 matching lines...) Expand all
31 def __init__(self): 33 def __init__(self):
32 self._timeline_model = None 34 self._timeline_model = None
33 self._tracing_timeline_data = None 35 self._tracing_timeline_data = None
34 self._interaction = None 36 self._interaction = None
35 37
36 def SetUp(self, page, tab): 38 def SetUp(self, page, tab):
37 # FIXME: Remove webkit.console when blink.console lands in chromium and 39 # FIXME: Remove webkit.console when blink.console lands in chromium and
38 # the ref builds are updated. crbug.com/386847 40 # the ref builds are updated. crbug.com/386847
39 custom_categories = ['webkit.console', 'blink.console', 'benchmark'] 41 custom_categories = ['webkit.console', 'blink.console', 'benchmark']
40 custom_categories += page.GetSyntheticDelayCategories() 42 custom_categories += page.GetSyntheticDelayCategories()
41 tab.browser.StartTracing(','.join(custom_categories), 60) 43 category_filter = tracing_category_filter.TracingCategoryFilter()
44 for c in custom_categories:
45 category_filter.AddIncludedCategory(c)
46 options = tracing_options.TracingOptions()
47 options.enable_chrome_trace = True
48 tab.browser.platform.tracing_controller.Start(options, category_filter, 60)
42 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 49 if tab.browser.platform.IsRawDisplayFrameRateSupported():
43 tab.browser.platform.StartRawDisplayFrameRateMeasurement() 50 tab.browser.platform.StartRawDisplayFrameRateMeasurement()
44 51
45 def Start(self, tab): 52 def Start(self, tab):
46 # Start the smooth marker for all smooth actions. 53 # Start the smooth marker for all smooth actions.
47 runner = action_runner.ActionRunner(tab) 54 runner = action_runner.ActionRunner(tab)
48 self._interaction = runner.BeginInteraction( 55 self._interaction = runner.BeginInteraction(
49 RUN_SMOOTH_ACTIONS, is_smooth=True) 56 RUN_SMOOTH_ACTIONS, is_smooth=True)
50 57
51 def Stop(self, tab): 58 def Stop(self, tab):
52 # End the smooth marker for all smooth actions. 59 # End the smooth marker for all smooth actions.
53 self._interaction.End() 60 self._interaction.End()
54 # Stop tracing for smoothness metric. 61 # Stop tracing for smoothness metric.
55 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 62 if tab.browser.platform.IsRawDisplayFrameRateSupported():
56 tab.browser.platform.StopRawDisplayFrameRateMeasurement() 63 tab.browser.platform.StopRawDisplayFrameRateMeasurement()
57 self._tracing_timeline_data = tab.browser.StopTracing() 64 self._tracing_timeline_data = tab.browser.platform.tracing_controller.Stop()
58 self._timeline_model = TimelineModel( 65 self._timeline_model = TimelineModel(
59 timeline_data=self._tracing_timeline_data) 66 timeline_data=self._tracing_timeline_data)
60 67
61 def AddResults(self, tab, results): 68 def AddResults(self, tab, results):
62 # Add results of smoothness metric. This computes the smoothness metric for 69 # Add results of smoothness metric. This computes the smoothness metric for
63 # the time ranges of gestures, if there is at least one, else the the time 70 # the time ranges of gestures, if there is at least one, else the the time
64 # ranges from the first action to the last action. 71 # ranges from the first action to the last action.
65 72
66 renderer_thread = self._timeline_model.GetRendererThreadFromTabId( 73 renderer_thread = self._timeline_model.GetRendererThreadFromTabId(
67 tab.id) 74 tab.id)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 results.current_page, r.name, r.unit, r.value, 117 results.current_page, r.name, r.unit, r.value,
111 description=DESCRIPTIONS.get(r.name))) 118 description=DESCRIPTIONS.get(r.name)))
112 else: 119 else:
113 results.AddValue(scalar.ScalarValue( 120 results.AddValue(scalar.ScalarValue(
114 results.current_page, r.name, r.unit, r.value, 121 results.current_page, r.name, r.unit, r.value,
115 description=DESCRIPTIONS.get(r.name))) 122 description=DESCRIPTIONS.get(r.name)))
116 123
117 def CleanUp(self, tab): 124 def CleanUp(self, tab):
118 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 125 if tab.browser.platform.IsRawDisplayFrameRateSupported():
119 tab.browser.platform.StopRawDisplayFrameRateMeasurement() 126 tab.browser.platform.StopRawDisplayFrameRateMeasurement()
120 if tab.browser.is_tracing_running: 127 if tab.browser.platform.tracing_controller.is_tracing_running:
121 tab.browser.StopTracing() 128 tab.browser.platform.tracing_controller.Stop()
OLDNEW
« no previous file with comments | « tools/perf/measurements/image_decoding.py ('k') | tools/perf/measurements/smoothness_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698