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