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 sys | 5 import sys |
6 import time | 6 import time |
7 | 7 |
8 from telemetry.core.util import TimeoutException | 8 from telemetry.core.util import TimeoutException |
9 from telemetry.page import page_measurement | 9 from telemetry.page import page_measurement |
10 from telemetry.page import page_test | |
10 | 11 |
11 class RasterizeAndRecordMicro(page_measurement.PageMeasurement): | 12 class RasterizeAndRecordMicro(page_measurement.PageMeasurement): |
12 def __init__(self): | 13 def __init__(self): |
13 super(RasterizeAndRecordMicro, self).__init__('', True) | 14 super(RasterizeAndRecordMicro, self).__init__('', True) |
15 self._compositing_features_enabled = False | |
14 | 16 |
15 def AddCommandLineOptions(self, parser): | 17 def AddCommandLineOptions(self, parser): |
16 parser.add_option('--start-wait-time', dest='start_wait_time', | 18 parser.add_option('--start-wait-time', dest='start_wait_time', |
17 default=2, | 19 default=2, |
18 help='Wait time before the benchmark is started ' + | 20 help='Wait time before the benchmark is started ' + |
19 '(must be long enought to load all content)') | 21 '(must be long enought to load all content)') |
20 parser.add_option('--rasterize-repeat', dest='rasterize_repeat', | 22 parser.add_option('--rasterize-repeat', dest='rasterize_repeat', |
21 default=100, | 23 default=100, |
22 help='Repeat each raster this many times. Increase ' + | 24 help='Repeat each raster this many times. Increase ' + |
23 'this value to reduce variance.') | 25 'this value to reduce variance.') |
24 parser.add_option('--record-repeat', dest='record_repeat', | 26 parser.add_option('--record-repeat', dest='record_repeat', |
25 default=100, | 27 default=100, |
26 help='Repeat each record this many times. Increase ' + | 28 help='Repeat each record this many times. Increase ' + |
27 'this value to reduce variance.') | 29 'this value to reduce variance.') |
28 parser.add_option('--timeout', dest='timeout', | 30 parser.add_option('--timeout', dest='timeout', |
29 default=120, | 31 default=120, |
30 help='The length of time to wait for the micro ' + | 32 help='The length of time to wait for the micro ' + |
31 'benchmark to finish, expressed in seconds.') | 33 'benchmark to finish, expressed in seconds.') |
32 | 34 |
33 def CustomizeBrowserOptions(self, options): | 35 def CustomizeBrowserOptions(self, options): |
34 options.AppendExtraBrowserArgs([ | 36 options.AppendExtraBrowserArgs([ |
35 '--enable-impl-side-painting', | 37 '--enable-impl-side-painting', |
36 '--force-compositing-mode', | 38 '--force-compositing-mode', |
37 '--enable-threaded-compositing', | 39 '--enable-threaded-compositing', |
38 '--enable-gpu-benchmarking' | 40 '--enable-gpu-benchmarking' |
39 ]) | 41 ]) |
40 | 42 |
43 def DidStartBrowser(self, browser): | |
44 # Check if the we actually have threaded forced compositing enabled. | |
vmpstr
2013/12/20 23:20:10
nit: s/the // and possibly s/forced //
| |
45 system_info = browser.GetSystemInfo() | |
46 if (system_info.gpu.feature_status | |
47 and system_info.gpu.feature_status.get( | |
vmpstr
2013/12/20 23:20:10
nit: I don't really know the (chromium) python sty
| |
48 'compositing', None) == 'enabled_force_threaded'): | |
vmpstr
2013/12/20 23:20:10
I think None is not needed here, assuming feature_
| |
49 self._compositing_features_enabled = True | |
50 | |
41 def MeasurePage(self, page, tab, results): | 51 def MeasurePage(self, page, tab, results): |
52 # Throw an exception if threaded forced compositing is not enabled. | |
53 if (not self._compositing_features_enabled): | |
54 raise page_test.TestNotSupportedOnPlatformFailure( | |
55 'Compositing feature status unknown or not '+ | |
56 'forced and threaded. Skipping measurement.') | |
57 | |
42 # TODO(vmpstr): Remove this temporary workaround when reference build has | 58 # TODO(vmpstr): Remove this temporary workaround when reference build has |
43 # been updated to branch 1713 or later. | 59 # been updated to branch 1713 or later. |
44 backend = tab.browser._browser_backend # pylint: disable=W0212 | 60 backend = tab.browser._browser_backend # pylint: disable=W0212 |
45 if (not hasattr(backend, 'chrome_branch_number') or | 61 if (not hasattr(backend, 'chrome_branch_number') or |
46 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): | 62 (sys.platform != 'android' and backend.chrome_branch_number < 1713)): |
47 print ('Warning: rasterize_and_record_micro requires Chrome branch 1713 ' | 63 raise page_test.TestNotSupportedOnPlatformFailure( |
48 'or later. Skipping measurement.') | 64 'rasterize_and_record_micro requires Chrome branch 1713 ' |
49 sys.exit(0) | 65 'or later. Skipping measurement.') |
50 | 66 |
51 try: | 67 try: |
52 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) | 68 tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10) |
53 except TimeoutException: | 69 except TimeoutException: |
54 pass | 70 pass |
55 time.sleep(float(self.options.start_wait_time)) | 71 time.sleep(float(self.options.start_wait_time)) |
56 | 72 |
57 record_repeat = self.options.record_repeat | 73 record_repeat = self.options.record_repeat |
58 rasterize_repeat = self.options.rasterize_repeat | 74 rasterize_repeat = self.options.rasterize_repeat |
59 # Enqueue benchmark | 75 # Enqueue benchmark |
(...skipping 24 matching lines...) Expand all Loading... | |
84 | 100 |
85 pixels_recorded = data['pixels_recorded'] | 101 pixels_recorded = data['pixels_recorded'] |
86 record_time = data['record_time_ms'] | 102 record_time = data['record_time_ms'] |
87 pixels_rasterized = data['pixels_rasterized'] | 103 pixels_rasterized = data['pixels_rasterized'] |
88 rasterize_time = data['rasterize_time_ms'] | 104 rasterize_time = data['rasterize_time_ms'] |
89 | 105 |
90 results.Add('pixels_recorded', '', pixels_recorded) | 106 results.Add('pixels_recorded', '', pixels_recorded) |
91 results.Add('record_time', 'ms', record_time) | 107 results.Add('record_time', 'ms', record_time) |
92 results.Add('pixels_rasterized', '', pixels_rasterized) | 108 results.Add('pixels_rasterized', '', pixels_rasterized) |
93 results.Add('rasterize_time', 'ms', rasterize_time) | 109 results.Add('rasterize_time', 'ms', rasterize_time) |
94 | |
OLD | NEW |