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

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: Fix smoothness_unittest.py. 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
« no previous file with comments | « no previous file | tools/perf/metrics/rendering_stats.py » ('j') | tools/perf/metrics/smoothness.py » ('J')
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 sys 5 import sys
6 import time 6 import time
7 7
8 from metrics import rendering_stats 8 from metrics import rendering_stats
9 from telemetry.page import page_measurement 9 from telemetry.page import page_measurement
10 from telemetry.core.timeline.model import MarkerMismatchError 10 from telemetry.core.timeline.model import MarkerMismatchError
11 from telemetry.core.timeline.model import MarkerOverlapError 11 from telemetry.core.timeline.model import MarkerOverlapError
12 12
13 TIMELINE_MARKER = 'RasterizeAndRecord'
14
13 15
14 class RasterizeAndRecord(page_measurement.PageMeasurement): 16 class RasterizeAndRecord(page_measurement.PageMeasurement):
15 def __init__(self): 17 def __init__(self):
16 super(RasterizeAndRecord, self).__init__('', True) 18 super(RasterizeAndRecord, self).__init__('', True)
17 self._metrics = None 19 self._metrics = None
18 20
19 def AddCommandLineOptions(self, parser): 21 def AddCommandLineOptions(self, parser):
20 parser.add_option('--raster-record-repeat', dest='raster_record_repeat', 22 parser.add_option('--raster-record-repeat', dest='raster_record_repeat',
21 default=20, 23 default=20,
22 help='Repetitions in raster and record loops.' + 24 help='Repetitions in raster and record loops.' +
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 'window.__rafFired = true;' 82 'window.__rafFired = true;'
81 '});') 83 '});')
82 84
83 time.sleep(float(self.options.stop_wait_time)) 85 time.sleep(float(self.options.stop_wait_time))
84 tab.browser.StartTracing('webkit.console,benchmark', 60) 86 tab.browser.StartTracing('webkit.console,benchmark', 60)
85 87
86 tab.ExecuteJavaScript( 88 tab.ExecuteJavaScript(
87 'window.__rafFired = false;' 89 'window.__rafFired = false;'
88 'window.webkitRequestAnimationFrame(function() {' 90 'window.webkitRequestAnimationFrame(function() {'
89 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();' 91 'chrome.gpuBenchmarking.setNeedsDisplayOnAllLayers();'
90 'console.time("' + rendering_stats.RENDER_PROCESS_MARKER + '");' 92 'console.time("' + TIMELINE_MARKER + '");'
91 'window.__rafFired = true;' 93 'window.__rafFired = true;'
92 '});') 94 '});')
93 # Wait until the frame was drawn. 95 # Wait until the frame was drawn.
94 # Needs to be adjusted for every device and for different 96 # Needs to be adjusted for every device and for different
95 # raster_record_repeat counts. 97 # raster_record_repeat counts.
96 # TODO(ernstm): replace by call-back. 98 # TODO(ernstm): replace by call-back.
97 time.sleep(float(self.options.stop_wait_time)) 99 time.sleep(float(self.options.stop_wait_time))
98 tab.ExecuteJavaScript( 100 tab.ExecuteJavaScript(
99 'console.timeEnd("' + rendering_stats.RENDER_PROCESS_MARKER + '")') 101 'console.timeEnd("' + TIMELINE_MARKER + '")')
100 102
101 timeline = tab.browser.StopTracing().AsTimelineModel() 103 timeline = tab.browser.StopTracing().AsTimelineModel()
102 try: 104 try:
103 timeline_markers = timeline.FindTimelineMarkers( 105 timeline_markers = timeline.FindTimelineMarkers(TIMELINE_MARKER)
104 rendering_stats.RENDER_PROCESS_MARKER)
105 except (MarkerMismatchError, MarkerOverlapError) as e: 106 except (MarkerMismatchError, MarkerOverlapError) as e:
106 raise page_measurement.MeasurementFailure(str(e)) 107 raise page_measurement.MeasurementFailure(str(e))
107 stats = rendering_stats.RenderingStats(timeline_markers, timeline_markers) 108 renderer_process = timeline.GetRendererProcessFromTab(tab)
109 stats = rendering_stats.RenderingStats(renderer_process, timeline_markers)
108 110
109 results.Add('rasterize_time', 'ms', 111 results.Add('rasterize_time', 'ms',
110 max(stats.rasterize_time)) 112 max(stats.rasterize_time))
111 results.Add('record_time', 'ms', 113 results.Add('record_time', 'ms',
112 max(stats.record_time)) 114 max(stats.record_time))
113 results.Add('rasterized_pixels', 'pixels', 115 results.Add('rasterized_pixels', 'pixels',
114 max(stats.rasterized_pixel_count)) 116 max(stats.rasterized_pixel_count))
115 results.Add('recorded_pixels', 'pixels', 117 results.Add('recorded_pixels', 'pixels',
116 max(stats.recorded_pixel_count)) 118 max(stats.recorded_pixel_count))
OLDNEW
« no previous file with comments | « no previous file | tools/perf/metrics/rendering_stats.py » ('j') | tools/perf/metrics/smoothness.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698