Chromium Code Reviews| 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 | |
| 6 import time | 5 import time |
| 7 | 6 |
| 8 from metrics import rendering_stats | 7 from metrics import rendering_stats |
| 9 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
| 9 from telemetry.page import page_test | |
| 10 from telemetry.page.perf_tests_helper import FlattenList | 10 from telemetry.page.perf_tests_helper import FlattenList |
| 11 import telemetry.core.timeline.bounds as timeline_bounds | 11 import telemetry.core.timeline.bounds as timeline_bounds |
| 12 from telemetry.core.timeline.model import TimelineModel | 12 from telemetry.core.timeline.model import TimelineModel |
| 13 from telemetry.core.timeline.model import MarkerMismatchError | 13 from telemetry.core.timeline.model import MarkerMismatchError |
| 14 from telemetry.core.timeline.model import MarkerOverlapError | 14 from telemetry.core.timeline.model import MarkerOverlapError |
| 15 | 15 |
| 16 TIMELINE_MARKER = 'RasterizeAndRecord' | 16 TIMELINE_MARKER = 'RasterizeAndRecord' |
| 17 | 17 |
| 18 | 18 |
| 19 class RasterizeAndRecord(page_measurement.PageMeasurement): | 19 class RasterizeAndRecord(page_measurement.PageMeasurement): |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 | 54 |
| 55 def DidStartBrowser(self, browser): | 55 def DidStartBrowser(self, browser): |
| 56 # Check if the we actually have threaded forced compositing enabled. | 56 # Check if the we actually have threaded forced compositing enabled. |
| 57 system_info = browser.GetSystemInfo() | 57 system_info = browser.GetSystemInfo() |
| 58 if (system_info.gpu.feature_status | 58 if (system_info.gpu.feature_status |
| 59 and system_info.gpu.feature_status.get( | 59 and system_info.gpu.feature_status.get( |
| 60 'compositing', None) == 'enabled_force_threaded'): | 60 'compositing', None) == 'enabled_force_threaded'): |
| 61 self._compositing_features_enabled = True | 61 self._compositing_features_enabled = True |
| 62 | 62 |
| 63 def MeasurePage(self, page, tab, results): | 63 def MeasurePage(self, page, tab, results): |
| 64 # Throw and exception if threaded forced compositing is not enabled. | |
|
tonyg
2014/03/14 01:32:49
s/and/an/
Or actually, just delete the comment al
ernstm
2014/03/24 22:27:22
Done.
| |
| 64 if not self._compositing_features_enabled: | 65 if not self._compositing_features_enabled: |
| 65 logging.warning('Warning: compositing feature status unknown or not '+ | 66 raise page_test.TestNotSupportedOnPlatformFailure( |
| 66 'forced and threaded. Skipping measurement.') | 67 'Compositing feature status unknown or not '+ |
| 67 return | 68 'forced and threaded. Skipping measurement.') |
| 68 | 69 |
| 69 # Rasterize only what's visible. | 70 # Rasterize only what's visible. |
| 70 tab.ExecuteJavaScript( | 71 tab.ExecuteJavaScript( |
| 71 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') | 72 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') |
| 72 | 73 |
| 73 # Wait until the page has loaded and come to a somewhat steady state. | 74 # Wait until the page has loaded and come to a somewhat steady state. |
| 74 # Needs to be adjusted for every device (~2 seconds for workstation). | 75 # Needs to be adjusted for every device (~2 seconds for workstation). |
| 75 time.sleep(float(self.options.start_wait_time)) | 76 time.sleep(float(self.options.start_wait_time)) |
| 76 | 77 |
| 77 # Render one frame before we start gathering a trace. On some pages, the | 78 # Render one frame before we start gathering a trace. On some pages, the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 115 |
| 115 stats = rendering_stats.RenderingStats( | 116 stats = rendering_stats.RenderingStats( |
| 116 renderer_process, timeline.browser_process, timeline_ranges) | 117 renderer_process, timeline.browser_process, timeline_ranges) |
| 117 | 118 |
| 118 results.Add('rasterize_time', 'ms', max(FlattenList(stats.rasterize_times))) | 119 results.Add('rasterize_time', 'ms', max(FlattenList(stats.rasterize_times))) |
| 119 results.Add('record_time', 'ms', max(FlattenList(stats.record_times))) | 120 results.Add('record_time', 'ms', max(FlattenList(stats.record_times))) |
| 120 results.Add('rasterized_pixels', 'pixels', | 121 results.Add('rasterized_pixels', 'pixels', |
| 121 max(FlattenList(stats.rasterized_pixel_counts))) | 122 max(FlattenList(stats.rasterized_pixel_counts))) |
| 122 results.Add('recorded_pixels', 'pixels', | 123 results.Add('recorded_pixels', 'pixels', |
| 123 max(FlattenList(stats.recorded_pixel_counts))) | 124 max(FlattenList(stats.recorded_pixel_counts))) |
| OLD | NEW |