OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 os | 4 import os |
5 | 5 |
6 from telemetry.core import util | 6 from telemetry.core import util |
7 | 7 |
8 TIMELINE_MARKER = 'smoothness_scroll' | 8 TIMELINE_MARKER = 'smoothness_scroll' |
9 | 9 |
10 class SmoothnessMetrics(object): | 10 class SmoothnessMetrics(object): |
11 def __init__(self, tab): | 11 def __init__(self, tab): |
12 self._tab = tab | 12 self._tab = tab |
13 with open( | 13 with open( |
14 os.path.join(os.path.dirname(__file__), | 14 os.path.join(os.path.dirname(__file__), |
15 'smoothness.js')) as f: | 15 'smoothness.js')) as f: |
16 js = f.read() | 16 js = f.read() |
17 tab.ExecuteJavaScript(js) | 17 tab.ExecuteJavaScript(js) |
18 | 18 |
19 @classmethod | 19 @classmethod |
20 def CustomizeBrowserOptions(cls, options): | 20 def CustomizeBrowserOptions(cls, options): |
21 options.AppendExtraBrowserArg('--enable-gpu-benchmarking') | 21 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
22 | 22 |
23 def Start(self): | 23 def Start(self): |
24 self._tab.ExecuteJavaScript( | 24 self._tab.ExecuteJavaScript( |
25 'window.__renderingStats = new __RenderingStats();' | 25 'window.__renderingStats = new __RenderingStats();' |
26 'window.__renderingStats.start()') | 26 'window.__renderingStats.start()') |
27 | 27 |
28 def SetNeedsDisplayOnAllLayersAndStart(self): | 28 def SetNeedsDisplayOnAllLayersAndStart(self): |
29 self._tab.ExecuteJavaScript( | 29 self._tab.ExecuteJavaScript( |
30 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();' | 30 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();' |
31 'window.__renderingStats = new __RenderingStats();' | 31 'window.__renderingStats = new __RenderingStats();' |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Average(s.touch_ui_latency, s.touch_ui_count, 1000, 3), | 175 Average(s.touch_ui_latency, s.touch_ui_count, 1000, 3), |
176 data_type='unimportant') | 176 data_type='unimportant') |
177 results.Add('average_touch_acked_latency', 'ms', | 177 results.Add('average_touch_acked_latency', 'ms', |
178 Average(s.touch_acked_latency, s.touch_acked_count, | 178 Average(s.touch_acked_latency, s.touch_acked_count, |
179 1000, 3), | 179 1000, 3), |
180 data_type='unimportant') | 180 data_type='unimportant') |
181 results.Add('average_scroll_update_latency', 'ms', | 181 results.Add('average_scroll_update_latency', 'ms', |
182 Average(s.scroll_update_latency, s.scroll_update_count, | 182 Average(s.scroll_update_latency, s.scroll_update_count, |
183 1000, 3), | 183 1000, 3), |
184 data_type='unimportant') | 184 data_type='unimportant') |
OLD | NEW |