OLD | NEW |
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 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 'console.timeEnd("' + TIMELINE_MARKER + '")') | 103 'console.timeEnd("' + TIMELINE_MARKER + '")') |
104 | 104 |
105 timeline = tab.browser.StopTracing().AsTimelineModel() | 105 timeline = tab.browser.StopTracing().AsTimelineModel() |
106 try: | 106 try: |
107 timeline_markers = timeline.FindTimelineMarkers(TIMELINE_MARKER) | 107 timeline_markers = timeline.FindTimelineMarkers(TIMELINE_MARKER) |
108 except (MarkerMismatchError, MarkerOverlapError) as e: | 108 except (MarkerMismatchError, MarkerOverlapError) as e: |
109 raise page_measurement.MeasurementFailure(str(e)) | 109 raise page_measurement.MeasurementFailure(str(e)) |
110 timeline_ranges = [ timeline_bounds.Bounds.CreateFromEvent(marker) | 110 timeline_ranges = [ timeline_bounds.Bounds.CreateFromEvent(marker) |
111 for marker in timeline_markers ] | 111 for marker in timeline_markers ] |
112 renderer_process = timeline.GetRendererProcessFromTab(tab) | 112 renderer_process = timeline.GetRendererProcessFromTab(tab) |
113 stats = rendering_stats.RenderingStats(renderer_process, timeline_ranges) | 113 browser_main_thread = timeline.GetBrowserMainThread() |
| 114 |
| 115 stats = rendering_stats.RenderingStats( |
| 116 renderer_process, browser_main_thread, timeline_ranges) |
114 | 117 |
115 results.Add('rasterize_time', 'ms', | 118 results.Add('rasterize_time', 'ms', |
116 max(stats.rasterize_time)) | 119 max(stats.rasterize_time)) |
117 results.Add('record_time', 'ms', | 120 results.Add('record_time', 'ms', |
118 max(stats.record_time)) | 121 max(stats.record_time)) |
119 results.Add('rasterized_pixels', 'pixels', | 122 results.Add('rasterized_pixels', 'pixels', |
120 max(stats.rasterized_pixel_count)) | 123 max(stats.rasterized_pixel_count)) |
121 results.Add('recorded_pixels', 'pixels', | 124 results.Add('recorded_pixels', 'pixels', |
122 max(stats.recorded_pixel_count)) | 125 max(stats.recorded_pixel_count)) |
OLD | NEW |