| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 sys | 5 import sys |
| 7 import time | 6 import time |
| 8 | 7 |
| 9 from telemetry.core.util import TimeoutException | 8 from telemetry.core.util import TimeoutException |
| 10 from telemetry.page import page_measurement | 9 from telemetry.page import page_measurement |
| 10 from telemetry.page import page_test |
| 11 | 11 |
| 12 class RasterizeAndRecordMicro(page_measurement.PageMeasurement): | 12 class RasterizeAndRecordMicro(page_measurement.PageMeasurement): |
| 13 def __init__(self): | 13 def __init__(self): |
| 14 super(RasterizeAndRecordMicro, self).__init__('', True) | 14 super(RasterizeAndRecordMicro, self).__init__('', True) |
| 15 self._compositing_features_enabled = False | 15 self._compositing_features_enabled = False |
| 16 | 16 |
| 17 @classmethod | 17 @classmethod |
| 18 def AddCommandLineArgs(cls, parser): | 18 def AddCommandLineArgs(cls, parser): |
| 19 parser.add_option('--start-wait-time', type='float', | 19 parser.add_option('--start-wait-time', type='float', |
| 20 default=2, | 20 default=2, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 43 '--enable-threaded-compositing', | 43 '--enable-threaded-compositing', |
| 44 '--enable-gpu-benchmarking' | 44 '--enable-gpu-benchmarking' |
| 45 ]) | 45 ]) |
| 46 | 46 |
| 47 def DidStartBrowser(self, browser): | 47 def DidStartBrowser(self, browser): |
| 48 # TODO(vmpstr): Remove this temporary workaround when reference build has | 48 # TODO(vmpstr): Remove this temporary workaround when reference build has |
| 49 # been updated to branch 1713 or later. | 49 # been updated to branch 1713 or later. |
| 50 backend = browser._browser_backend # pylint: disable=W0212 | 50 backend = browser._browser_backend # pylint: disable=W0212 |
| 51 if (not hasattr(backend, 'chrome_branch_number') or | 51 if (not hasattr(backend, 'chrome_branch_number') or |
| 52 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): | 52 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): |
| 53 return | 53 raise page_test.TestNotSupportedOnPlatformFailure( |
| 54 'rasterize_and_record_micro requires Chrome branch 1713 ' |
| 55 'or later. Skipping measurement.') |
| 54 | 56 |
| 55 # Check if the we actually have threaded forced compositing enabled. | 57 # Check if the we actually have threaded forced compositing enabled. |
| 56 system_info = browser.GetSystemInfo() | 58 system_info = browser.GetSystemInfo() |
| 57 if (system_info.gpu.feature_status | 59 if (system_info.gpu.feature_status |
| 58 and system_info.gpu.feature_status.get( | 60 and system_info.gpu.feature_status.get( |
| 59 'compositing', None) == 'enabled_force_threaded'): | 61 'compositing', None) == 'enabled_force_threaded'): |
| 60 self._compositing_features_enabled = True | 62 self._compositing_features_enabled = True |
| 61 | 63 |
| 62 def MeasurePage(self, page, tab, results): | 64 def MeasurePage(self, page, tab, results): |
| 63 if not self._compositing_features_enabled: | 65 if not self._compositing_features_enabled: |
| 64 logging.warning('Warning: RasterizeAndRecordMicro requires forced, ' | 66 raise page_test.TestNotSupportedOnPlatformFailure( |
| 65 'threaded compositing and Chrome branch 1713 or newer.') | 67 'Compositing feature status unknown or not '+ |
| 66 return | 68 'forced and threaded. Skipping measurement.') |
| 67 | 69 |
| 68 try: | 70 try: |
| 69 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) | 71 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) |
| 70 except TimeoutException: | 72 except TimeoutException: |
| 71 pass | 73 pass |
| 72 time.sleep(self.options.start_wait_time) | 74 time.sleep(self.options.start_wait_time) |
| 73 | 75 |
| 74 record_repeat = self.options.record_repeat | 76 record_repeat = self.options.record_repeat |
| 75 rasterize_repeat = self.options.rasterize_repeat | 77 rasterize_repeat = self.options.rasterize_repeat |
| 76 # Enqueue benchmark | 78 # Enqueue benchmark |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', | 126 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', |
| 125 pixels_rasterized_with_non_solid_color) | 127 pixels_rasterized_with_non_solid_color) |
| 126 results.Add('pixels_rasterized_as_opaque', 'pixels', | 128 results.Add('pixels_rasterized_as_opaque', 'pixels', |
| 127 pixels_rasterized_as_opaque) | 129 pixels_rasterized_as_opaque) |
| 128 results.Add('total_layers', 'count', total_layers) | 130 results.Add('total_layers', 'count', total_layers) |
| 129 results.Add('total_picture_layers', 'count', total_picture_layers) | 131 results.Add('total_picture_layers', 'count', total_picture_layers) |
| 130 results.Add('total_picture_layers_with_no_content', 'count', | 132 results.Add('total_picture_layers_with_no_content', 'count', |
| 131 total_picture_layers_with_no_content) | 133 total_picture_layers_with_no_content) |
| 132 results.Add('total_picture_layers_off_screen', 'count', | 134 results.Add('total_picture_layers_off_screen', 'count', |
| 133 total_picture_layers_off_screen) | 135 total_picture_layers_off_screen) |
| 134 | |
| OLD | NEW |