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

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

Issue 29423005: telemetry: Add GetRendererProcessFromTab to timeline model. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean-ups. Created 7 years, 1 month 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 (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 logging 5 import logging
6 import sys 6 import sys
7 import time 7 import time
8 8
9 from metrics import rendering_stats 9 from metrics import rendering_stats
10 from telemetry.page import page_measurement 10 from telemetry.page import page_measurement
11 from telemetry.core.timeline.model import MarkerMismatchError 11 from telemetry.core.timeline.model import MarkerMismatchError
12 from telemetry.core.timeline.model import MarkerOverlapError 12 from telemetry.core.timeline.model import MarkerOverlapError
13 13
14 TIMELINE_MARKER = 'RasterizeAndRecord'
15
14 16
15 class RasterizeAndRecord(page_measurement.PageMeasurement): 17 class RasterizeAndRecord(page_measurement.PageMeasurement):
16 def __init__(self): 18 def __init__(self):
17 super(RasterizeAndRecord, self).__init__('', True) 19 super(RasterizeAndRecord, self).__init__('', True)
18 self._metrics = None 20 self._metrics = None
19 self._compositing_features_enabled = False 21 self._compositing_features_enabled = False
20 22
21 def AddCommandLineOptions(self, parser): 23 def AddCommandLineOptions(self, parser):
22 parser.add_option('--raster-record-repeat', dest='raster_record_repeat', 24 parser.add_option('--raster-record-repeat', dest='raster_record_repeat',
23 default=20, 25 default=20,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 'window.__rafFired = true;' 92 'window.__rafFired = true;'
91 '});') 93 '});')
92 94
93 time.sleep(float(self.options.stop_wait_time)) 95 time.sleep(float(self.options.stop_wait_time))
94 tab.browser.StartTracing('webkit.console,benchmark', 60) 96 tab.browser.StartTracing('webkit.console,benchmark', 60)
95 97
96 tab.ExecuteJavaScript( 98 tab.ExecuteJavaScript(
97 'window.__rafFired = false;' 99 'window.__rafFired = false;'
98 'window.webkitRequestAnimationFrame(function() {' 100 'window.webkitRequestAnimationFrame(function() {'
99 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();' 101 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();'
100 'console.time("' + rendering_stats.RENDER_PROCESS_MARKER + '");' 102 'console.time("' + TIMELINE_MARKER + '");'
101 'window.__rafFired = true;' 103 'window.__rafFired = true;'
102 '});') 104 '});')
103 # Wait until the frame was drawn. 105 # Wait until the frame was drawn.
104 # Needs to be adjusted for every device and for different 106 # Needs to be adjusted for every device and for different
105 # raster_record_repeat counts. 107 # raster_record_repeat counts.
106 # TODO(ernstm): replace by call-back. 108 # TODO(ernstm): replace by call-back.
107 time.sleep(float(self.options.stop_wait_time)) 109 time.sleep(float(self.options.stop_wait_time))
108 tab.ExecuteJavaScript( 110 tab.ExecuteJavaScript(
109 'console.timeEnd("' + rendering_stats.RENDER_PROCESS_MARKER + '")') 111 'console.timeEnd("' + TIMELINE_MARKER + '")')
110 112
111 timeline = tab.browser.StopTracing().AsTimelineModel() 113 timeline = tab.browser.StopTracing().AsTimelineModel()
112 try: 114 try:
113 timeline_markers = timeline.FindTimelineMarkers( 115 timeline_markers = timeline.FindTimelineMarkers(TIMELINE_MARKER)
114 rendering_stats.RENDER_PROCESS_MARKER)
115 except (MarkerMismatchError, MarkerOverlapError) as e: 116 except (MarkerMismatchError, MarkerOverlapError) as e:
116 raise page_measurement.MeasurementFailure(str(e)) 117 raise page_measurement.MeasurementFailure(str(e))
117 stats = rendering_stats.RenderingStats(timeline_markers, timeline_markers) 118 renderer_process = timeline.GetRendererProcessFromTab(tab)
119 stats = rendering_stats.RenderingStats(renderer_process, timeline_markers)
118 120
119 results.Add('rasterize_time', 'ms', 121 results.Add('rasterize_time', 'ms',
120 max(stats.rasterize_time)) 122 max(stats.rasterize_time))
121 results.Add('record_time', 'ms', 123 results.Add('record_time', 'ms',
122 max(stats.record_time)) 124 max(stats.record_time))
123 results.Add('rasterized_pixels', 'pixels', 125 results.Add('rasterized_pixels', 'pixels',
124 max(stats.rasterized_pixel_count)) 126 max(stats.rasterized_pixel_count))
125 results.Add('recorded_pixels', 'pixels', 127 results.Add('recorded_pixels', 'pixels',
126 max(stats.recorded_pixel_count)) 128 max(stats.recorded_pixel_count))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698