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

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

Issue 23902027: telemetry: Make trace profiler work with trace-based benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add subset test for category filters. Created 7 years, 3 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
« no previous file with comments | « no previous file | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 import time 5 import time
6 6
7 from metrics import smoothness 7 from metrics import smoothness
8 from telemetry.page import page_measurement 8 from telemetry.page import page_measurement
9 9
10 class StatsCollector(object): 10 class StatsCollector(object):
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 # first frame requested has more variance in the number of pixels 141 # first frame requested has more variance in the number of pixels
142 # rasterized. 142 # rasterized.
143 tab.ExecuteJavaScript(""" 143 tab.ExecuteJavaScript("""
144 window.__rafFired = false; 144 window.__rafFired = false;
145 window.webkitRequestAnimationFrame(function() { 145 window.webkitRequestAnimationFrame(function() {
146 chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers(); 146 chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();
147 window.__rafFired = true; 147 window.__rafFired = true;
148 }); 148 });
149 """) 149 """)
150 150
151 tab.browser.StartTracing('webkit,webkit.console,benchmark', 60) 151 tab.browser.StartTracing('webkit.console,benchmark', 60)
152 self._metrics.Start() 152 self._metrics.Start()
153 153
154 tab.ExecuteJavaScript(""" 154 tab.ExecuteJavaScript("""
155 console.time("measureNextFrame"); 155 console.time("measureNextFrame");
156 window.__rafFired = false; 156 window.__rafFired = false;
157 window.webkitRequestAnimationFrame(function() { 157 window.webkitRequestAnimationFrame(function() {
158 chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers(); 158 chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();
159 window.__rafFired = true; 159 window.__rafFired = true;
160 }); 160 });
161 """) 161 """)
162 # Wait until the frame was drawn. 162 # Wait until the frame was drawn.
163 # Needs to be adjusted for every device and for different 163 # Needs to be adjusted for every device and for different
164 # raster_record_repeat counts. 164 # raster_record_repeat counts.
165 # TODO(ernstm): replace by call-back. 165 # TODO(ernstm): replace by call-back.
166 time.sleep(float(self.options.stop_wait_time)) 166 time.sleep(float(self.options.stop_wait_time))
167 tab.ExecuteJavaScript('console.timeEnd("measureNextFrame")') 167 tab.ExecuteJavaScript('console.timeEnd("measureNextFrame")')
168 168
169 tab.browser.StopTracing()
170 self._metrics.Stop() 169 self._metrics.Stop()
170 timeline = tab.browser.StopTracing().AsTimelineModel()
171 171
172 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel()
173 collector = StatsCollector(timeline) 172 collector = StatsCollector(timeline)
174 collector.GatherRenderingStats() 173 collector.GatherRenderingStats()
175 174
176 rendering_stats = self._metrics.end_values 175 rendering_stats = self._metrics.end_values
177 176
178 results.Add('best_rasterize_time', 'seconds', 177 results.Add('best_rasterize_time', 'seconds',
179 collector.total_best_rasterize_time / 1.e3, 178 collector.total_best_rasterize_time / 1.e3,
180 data_type='unimportant') 179 data_type='unimportant')
181 results.Add('best_record_time', 'seconds', 180 results.Add('best_record_time', 'seconds',
182 collector.total_best_record_time / 1.e3, 181 collector.total_best_record_time / 1.e3,
183 data_type='unimportant') 182 data_type='unimportant')
184 results.Add('total_pixels_rasterized', 'pixels', 183 results.Add('total_pixels_rasterized', 'pixels',
185 collector.total_pixels_rasterized, 184 collector.total_pixels_rasterized,
186 data_type='unimportant') 185 data_type='unimportant')
187 results.Add('total_pixels_recorded', 'pixels', 186 results.Add('total_pixels_recorded', 'pixels',
188 collector.total_pixels_recorded, 187 collector.total_pixels_recorded,
189 data_type='unimportant') 188 data_type='unimportant')
190 189
191 if self.options.report_all_results: 190 if self.options.report_all_results:
192 for k, v in rendering_stats.iteritems(): 191 for k, v in rendering_stats.iteritems():
193 results.Add(k, '', v) 192 results.Add(k, '', v)
OLDNEW
« no previous file with comments | « no previous file | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698