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

Side by Side Diff: tools/perf/perf_tools/smoothness_benchmark.py

Issue 12499006: Telemetry on android: improves RawDisplayFrameRateMeasurement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 perf_tools import smoothness_measurement 4 from perf_tools import smoothness_measurement
5 from telemetry.core import util 5 from telemetry.core import util
6 from telemetry.page import page_benchmark 6 from telemetry.page import page_benchmark
7 7
8 class DidNotScrollException(page_benchmark.MeasurementFailure): 8 class DidNotScrollException(page_benchmark.MeasurementFailure):
9 def __init__(self): 9 def __init__(self):
10 super(DidNotScrollException, self).__init__('Page did not scroll') 10 super(DidNotScrollException, self).__init__('Page did not scroll')
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 def CustomizeBrowserOptions(self, options): 157 def CustomizeBrowserOptions(self, options):
158 if self.use_gpu_benchmarking_extension: 158 if self.use_gpu_benchmarking_extension:
159 options.extra_browser_args.append('--enable-gpu-benchmarking') 159 options.extra_browser_args.append('--enable-gpu-benchmarking')
160 if self.force_enable_threaded_compositing: 160 if self.force_enable_threaded_compositing:
161 options.extra_browser_args.append('--enable-threaded-compositing') 161 options.extra_browser_args.append('--enable-threaded-compositing')
162 162
163 def CanRunForPage(self, page): 163 def CanRunForPage(self, page):
164 return hasattr(page, 'smoothness') 164 return hasattr(page, 'smoothness')
165 165
166 def WillRunAction(self, page, tab, action): 166 def WillRunAction(self, page, tab, action):
167 if tab.browser.platform.IsRawDisplayFrameRateSupported():
168 tab.browser.platform.StartRawDisplayFrameRateMeasurement()
167 self._measurement = smoothness_measurement.SmoothnessMeasurement(tab) 169 self._measurement = smoothness_measurement.SmoothnessMeasurement(tab)
168 if action.CanBeBound(): 170 if action.CanBeBound():
169 self._measurement.BindToAction(action) 171 self._measurement.BindToAction(action)
170 else: 172 else:
171 self._measurement.Start() 173 self._measurement.Start()
172 174
173 def DidRunAction(self, page, tab, action): 175 def DidRunAction(self, page, tab, action):
176 if tab.browser.platform.IsRawDisplayFrameRateSupported():
177 tab.browser.platform.StopRawDisplayFrameRateMeasurement()
174 if not action.CanBeBound(): 178 if not action.CanBeBound():
175 self._measurement.Stop() 179 self._measurement.Stop()
176 180
177 def MeasurePage(self, page, tab, results): 181 def MeasurePage(self, page, tab, results):
178 rendering_stats_deltas = self._measurement.deltas 182 rendering_stats_deltas = self._measurement.deltas
179 183
180 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): 184 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0):
181 raise DidNotScrollException() 185 raise DidNotScrollException()
182 186
183 load_timings = tab.EvaluateJavaScript("window.performance.timing") 187 load_timings = tab.EvaluateJavaScript("window.performance.timing")
184 load_time_seconds = ( 188 load_time_seconds = (
185 float(load_timings['loadEventStart']) - 189 float(load_timings['loadEventStart']) -
186 load_timings['navigationStart']) / 1000 190 load_timings['navigationStart']) / 1000
187 dom_content_loaded_time_seconds = ( 191 dom_content_loaded_time_seconds = (
188 float(load_timings['domContentLoadedEventStart']) - 192 float(load_timings['domContentLoadedEventStart']) -
189 load_timings['navigationStart']) / 1000 193 load_timings['navigationStart']) / 1000
190 results.Add('load_time', 'seconds', load_time_seconds) 194 results.Add('load_time', 'seconds', load_time_seconds)
191 results.Add('dom_content_loaded_time', 'seconds', 195 results.Add('dom_content_loaded_time', 'seconds',
192 dom_content_loaded_time_seconds) 196 dom_content_loaded_time_seconds)
193 197
194 CalcFirstPaintTimeResults(results, tab) 198 CalcFirstPaintTimeResults(results, tab)
195 CalcScrollResults(rendering_stats_deltas, results) 199 CalcScrollResults(rendering_stats_deltas, results)
196 CalcPaintingResults(rendering_stats_deltas, results) 200 CalcPaintingResults(rendering_stats_deltas, results)
197 CalcTextureUploadResults(rendering_stats_deltas, results) 201 CalcTextureUploadResults(rendering_stats_deltas, results)
198 CalcImageDecodingResults(rendering_stats_deltas, results) 202 CalcImageDecodingResults(rendering_stats_deltas, results)
199 203
200 if self.options.report_all_results: 204 if self.options.report_all_results:
201 for k, v in rendering_stats_deltas.iteritems(): 205 for k, v in rendering_stats_deltas.iteritems():
202 results.Add(k, '', v) 206 results.Add(k, '', v)
207
208 if tab.browser.platform.IsRawDisplayFrameRateSupported():
209 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
210 results.Add(r.name, r.unit, r.value)
OLDNEW
« no previous file with comments | « build/android/pylib/surface_stats_collector.py ('k') | tools/telemetry/telemetry/core/chrome/android_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698