| 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 def AddCommandLineOptions(self, parser): | 17 def AddCommandLineOptions(self, parser): |
| 18 parser.add_option('--start-wait-time', dest='start_wait_time', | 18 parser.add_option('--start-wait-time', dest='start_wait_time', |
| 19 default=2, | 19 default=2, |
| 20 help='Wait time before the benchmark is started ' + | 20 help='Wait time before the benchmark is started ' + |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 '--enable-threaded-compositing', | 42 '--enable-threaded-compositing', |
| 43 '--enable-gpu-benchmarking' | 43 '--enable-gpu-benchmarking' |
| 44 ]) | 44 ]) |
| 45 | 45 |
| 46 def DidStartBrowser(self, browser): | 46 def DidStartBrowser(self, browser): |
| 47 # TODO(vmpstr): Remove this temporary workaround when reference build has | 47 # TODO(vmpstr): Remove this temporary workaround when reference build has |
| 48 # been updated to branch 1713 or later. | 48 # been updated to branch 1713 or later. |
| 49 backend = browser._browser_backend # pylint: disable=W0212 | 49 backend = browser._browser_backend # pylint: disable=W0212 |
| 50 if (not hasattr(backend, 'chrome_branch_number') or | 50 if (not hasattr(backend, 'chrome_branch_number') or |
| 51 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): | 51 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): |
| 52 return | 52 raise page_test.TestNotSupportedOnPlatformFailure( |
| 53 'rasterize_and_record_micro requires Chrome branch 1713 ' |
| 54 'or later. Skipping measurement.') |
| 53 | 55 |
| 54 # Check if the we actually have threaded forced compositing enabled. | 56 # Check if the we actually have threaded forced compositing enabled. |
| 55 system_info = browser.GetSystemInfo() | 57 system_info = browser.GetSystemInfo() |
| 56 if (system_info.gpu.feature_status | 58 if (system_info.gpu.feature_status |
| 57 and system_info.gpu.feature_status.get( | 59 and system_info.gpu.feature_status.get( |
| 58 'compositing', None) == 'enabled_force_threaded'): | 60 'compositing', None) == 'enabled_force_threaded'): |
| 59 self._compositing_features_enabled = True | 61 self._compositing_features_enabled = True |
| 60 | 62 |
| 61 def MeasurePage(self, page, tab, results): | 63 def MeasurePage(self, page, tab, results): |
| 64 # Throw an exception if threaded forced compositing is not enabled. |
| 62 if not self._compositing_features_enabled: | 65 if not self._compositing_features_enabled: |
| 63 logging.warning('Warning: RasterizeAndRecordMicro requires forced, ' | 66 raise page_test.TestNotSupportedOnPlatformFailure( |
| 64 'threaded compositing and Chrome branch 1713 or newer.') | 67 'Compositing feature status unknown or not '+ |
| 65 return | 68 'forced and threaded. Skipping measurement.') |
| 66 | 69 |
| 67 try: | 70 try: |
| 68 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) | 71 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) |
| 69 except TimeoutException: | 72 except TimeoutException: |
| 70 pass | 73 pass |
| 71 time.sleep(float(self.options.start_wait_time)) | 74 time.sleep(float(self.options.start_wait_time)) |
| 72 | 75 |
| 73 record_repeat = self.options.record_repeat | 76 record_repeat = self.options.record_repeat |
| 74 rasterize_repeat = self.options.rasterize_repeat | 77 rasterize_repeat = self.options.rasterize_repeat |
| 75 # Enqueue benchmark | 78 # Enqueue benchmark |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', | 126 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', |
| 124 pixels_rasterized_with_non_solid_color) | 127 pixels_rasterized_with_non_solid_color) |
| 125 results.Add('pixels_rasterized_as_opaque', 'pixels', | 128 results.Add('pixels_rasterized_as_opaque', 'pixels', |
| 126 pixels_rasterized_as_opaque) | 129 pixels_rasterized_as_opaque) |
| 127 results.Add('total_layers', 'count', total_layers) | 130 results.Add('total_layers', 'count', total_layers) |
| 128 results.Add('total_picture_layers', 'count', total_picture_layers) | 131 results.Add('total_picture_layers', 'count', total_picture_layers) |
| 129 results.Add('total_picture_layers_with_no_content', 'count', | 132 results.Add('total_picture_layers_with_no_content', 'count', |
| 130 total_picture_layers_with_no_content) | 133 total_picture_layers_with_no_content) |
| 131 results.Add('total_picture_layers_off_screen', 'count', | 134 results.Add('total_picture_layers_off_screen', 'count', |
| 132 total_picture_layers_off_screen) | 135 total_picture_layers_off_screen) |
| 133 | |
| OLD | NEW |