| 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 time | 5 import time |
| 6 | 6 |
| 7 from telemetry.page import legacy_page_test | 7 from telemetry.page import legacy_page_test |
| 8 from telemetry.value import scalar | 8 from telemetry.value import scalar |
| 9 | 9 |
| 10 import py_utils | 10 import py_utils |
| 11 | 11 |
| 12 COUNTERS = [ |
| 13 "lo_all", |
| 14 "lo_floatLayerBug1", |
| 15 "lo_floatLayerBug2", |
| 16 "lo_svgForeignBug", |
| 17 ] |
| 18 |
| 19 # assert len(COUNTERS) == 55 + 9 + 7 |
| 20 |
| 12 class RasterizeAndRecordMicro(legacy_page_test.LegacyPageTest): | 21 class RasterizeAndRecordMicro(legacy_page_test.LegacyPageTest): |
| 13 | 22 |
| 14 def __init__(self, start_wait_time=2, rasterize_repeat=100, record_repeat=100, | 23 def __init__(self, start_wait_time=2, rasterize_repeat=100, record_repeat=100, |
| 15 timeout=120, report_detailed_results=False): | 24 timeout=9999, report_detailed_results=False): |
| 16 super(RasterizeAndRecordMicro, self).__init__() | 25 super(RasterizeAndRecordMicro, self).__init__() |
| 17 self._chrome_branch_number = None | 26 self._chrome_branch_number = None |
| 18 self._start_wait_time = start_wait_time | 27 self._start_wait_time = start_wait_time |
| 19 self._rasterize_repeat = rasterize_repeat | 28 self._rasterize_repeat = rasterize_repeat |
| 20 self._record_repeat = record_repeat | 29 self._record_repeat = record_repeat |
| 21 self._timeout = timeout | 30 self._timeout = timeout |
| 22 self._report_detailed_results = report_detailed_results | 31 self._report_detailed_results = report_detailed_results |
| 23 | 32 |
| 24 def CustomizeBrowserOptions(self, options): | 33 def CustomizeBrowserOptions(self, options): |
| 25 options.AppendExtraBrowserArgs([ | 34 options.AppendExtraBrowserArgs([ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 'window.benchmark_results.id', timeout=self._timeout) | 66 'window.benchmark_results.id', timeout=self._timeout) |
| 58 if not benchmark_id: | 67 if not benchmark_id: |
| 59 raise legacy_page_test.MeasurementFailure( | 68 raise legacy_page_test.MeasurementFailure( |
| 60 'Failed to schedule rasterize_and_record_micro') | 69 'Failed to schedule rasterize_and_record_micro') |
| 61 | 70 |
| 62 tab.WaitForJavaScriptCondition( | 71 tab.WaitForJavaScriptCondition( |
| 63 'window.benchmark_results.done', timeout=self._timeout) | 72 'window.benchmark_results.done', timeout=self._timeout) |
| 64 | 73 |
| 65 data = tab.EvaluateJavaScript('window.benchmark_results.results') | 74 data = tab.EvaluateJavaScript('window.benchmark_results.results') |
| 66 | 75 |
| 67 pixels_recorded = data['pixels_recorded'] | 76 for c in COUNTERS: |
| 68 record_time = data['record_time_ms'] | 77 count = data.get(c, 0) |
| 69 pixels_rasterized = data['pixels_rasterized'] | 78 results.AddValue(scalar.ScalarValue(results.current_page, |
| 70 rasterize_time = data['rasterize_time_ms'] | 79 c, 'count', count)) |
| 71 picture_memory_usage = data['picture_memory_usage'] | |
| 72 | |
| 73 results.AddValue(scalar.ScalarValue( | |
| 74 results.current_page, 'pixels_recorded', 'pixels', pixels_recorded)) | |
| 75 results.AddValue(scalar.ScalarValue( | |
| 76 results.current_page, 'pixels_rasterized', 'pixels', pixels_rasterized)) | |
| 77 results.AddValue(scalar.ScalarValue( | |
| 78 results.current_page, 'rasterize_time', 'ms', rasterize_time)) | |
| 79 results.AddValue(scalar.ScalarValue( | |
| 80 results.current_page, 'viewport_picture_size', 'bytes', | |
| 81 picture_memory_usage)) | |
| 82 results.AddValue(scalar.ScalarValue( | |
| 83 results.current_page, 'record_time', 'ms', record_time)) | |
| 84 | |
| 85 record_time_painting_disabled = data['record_time_painting_disabled_ms'] | |
| 86 record_time_caching_disabled = data['record_time_caching_disabled_ms'] | |
| 87 record_time_construction_disabled = \ | |
| 88 data['record_time_construction_disabled_ms'] | |
| 89 # TODO(wangxianzhu): Remove this workaround when reference builds get past | |
| 90 # r367465. | |
| 91 record_time_subsequence_caching_disabled = \ | |
| 92 data.get('record_time_subsequence_caching_disabled_ms', 0) | |
| 93 # TODO(wkorman): Remove the default-to-zero workaround below when | |
| 94 # reference builds get past the change that adds this comment. | |
| 95 record_time_partial_invalidation = \ | |
| 96 data.get('record_time_partial_invalidation_ms', 0) | |
| 97 results.AddValue(scalar.ScalarValue( | |
| 98 results.current_page, 'record_time_painting_disabled', 'ms', | |
| 99 record_time_painting_disabled)) | |
| 100 results.AddValue(scalar.ScalarValue( | |
| 101 results.current_page, 'record_time_caching_disabled', 'ms', | |
| 102 record_time_caching_disabled)) | |
| 103 results.AddValue(scalar.ScalarValue( | |
| 104 results.current_page, 'record_time_construction_disabled', 'ms', | |
| 105 record_time_construction_disabled)) | |
| 106 results.AddValue(scalar.ScalarValue( | |
| 107 results.current_page, 'record_time_subsequence_caching_disabled', 'ms', | |
| 108 record_time_subsequence_caching_disabled)) | |
| 109 results.AddValue(scalar.ScalarValue( | |
| 110 results.current_page, 'record_time_partial_invalidation_ms', 'ms', | |
| 111 record_time_partial_invalidation)) | |
| 112 | |
| 113 if self._report_detailed_results: | |
| 114 pixels_rasterized_with_non_solid_color = \ | |
| 115 data['pixels_rasterized_with_non_solid_color'] | |
| 116 pixels_rasterized_as_opaque = \ | |
| 117 data['pixels_rasterized_as_opaque'] | |
| 118 total_layers = data['total_layers'] | |
| 119 total_picture_layers = data['total_picture_layers'] | |
| 120 total_picture_layers_with_no_content = \ | |
| 121 data['total_picture_layers_with_no_content'] | |
| 122 total_picture_layers_off_screen = \ | |
| 123 data['total_picture_layers_off_screen'] | |
| 124 # TODO(wkorman): Why are we storing rasterize_results_.total_memory_usage | |
| 125 # in a field called |total_pictures_in_pile_size|? Did we just repurpose | |
| 126 # that field to avoid having to rename/create another? | |
| 127 total_pictures_in_pile_size = data['total_pictures_in_pile_size'] | |
| 128 | |
| 129 results.AddValue(scalar.ScalarValue( | |
| 130 results.current_page, 'total_size_of_pictures_in_piles', 'bytes', | |
| 131 total_pictures_in_pile_size)) | |
| 132 results.AddValue(scalar.ScalarValue( | |
| 133 results.current_page, 'pixels_rasterized_with_non_solid_color', | |
| 134 'pixels', pixels_rasterized_with_non_solid_color)) | |
| 135 results.AddValue(scalar.ScalarValue( | |
| 136 results.current_page, 'pixels_rasterized_as_opaque', 'pixels', | |
| 137 pixels_rasterized_as_opaque)) | |
| 138 results.AddValue(scalar.ScalarValue( | |
| 139 results.current_page, 'total_layers', 'count', total_layers)) | |
| 140 results.AddValue(scalar.ScalarValue( | |
| 141 results.current_page, 'total_picture_layers', 'count', | |
| 142 total_picture_layers)) | |
| 143 results.AddValue(scalar.ScalarValue( | |
| 144 results.current_page, 'total_picture_layers_with_no_content', 'count', | |
| 145 total_picture_layers_with_no_content)) | |
| 146 results.AddValue(scalar.ScalarValue( | |
| 147 results.current_page, 'total_picture_layers_off_screen', 'count', | |
| 148 total_picture_layers_off_screen)) | |
| OLD | NEW |