| 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.core import exceptions | 7 from telemetry.core import exceptions |
| 8 from telemetry.page import legacy_page_test | 8 from telemetry.page import legacy_page_test |
| 9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 tab.WaitForJavaScriptExpression( | 60 tab.WaitForJavaScriptExpression( |
| 61 'window.benchmark_results.done', self._timeout) | 61 'window.benchmark_results.done', self._timeout) |
| 62 | 62 |
| 63 data = tab.EvaluateJavaScript('window.benchmark_results.results') | 63 data = tab.EvaluateJavaScript('window.benchmark_results.results') |
| 64 | 64 |
| 65 pixels_recorded = data['pixels_recorded'] | 65 pixels_recorded = data['pixels_recorded'] |
| 66 record_time = data['record_time_ms'] | 66 record_time = data['record_time_ms'] |
| 67 pixels_rasterized = data['pixels_rasterized'] | 67 pixels_rasterized = data['pixels_rasterized'] |
| 68 rasterize_time = data['rasterize_time_ms'] | 68 rasterize_time = data['rasterize_time_ms'] |
| 69 # TODO(schenney): Remove this workaround when reference builds get past | 69 picture_memory_usage = data['picture_memory_usage'] |
| 70 # the change that adds this comment. | |
| 71 if 'picture_memory_usage' in data: | |
| 72 picture_memory_usage = data['picture_memory_usage'] | |
| 73 else: | |
| 74 picture_memory_usage = 0 | |
| 75 | 70 |
| 76 results.AddValue(scalar.ScalarValue( | 71 results.AddValue(scalar.ScalarValue( |
| 77 results.current_page, 'pixels_recorded', 'pixels', pixels_recorded)) | 72 results.current_page, 'pixels_recorded', 'pixels', pixels_recorded)) |
| 78 results.AddValue(scalar.ScalarValue( | 73 results.AddValue(scalar.ScalarValue( |
| 79 results.current_page, 'pixels_rasterized', 'pixels', pixels_rasterized)) | 74 results.current_page, 'pixels_rasterized', 'pixels', pixels_rasterized)) |
| 80 results.AddValue(scalar.ScalarValue( | 75 results.AddValue(scalar.ScalarValue( |
| 81 results.current_page, 'rasterize_time', 'ms', rasterize_time)) | 76 results.current_page, 'rasterize_time', 'ms', rasterize_time)) |
| 82 results.AddValue(scalar.ScalarValue( | 77 results.AddValue(scalar.ScalarValue( |
| 83 results.current_page, 'viewport_picture_size', 'bytes', | 78 results.current_page, 'viewport_picture_size', 'bytes', |
| 84 picture_memory_usage)) | 79 picture_memory_usage)) |
| 85 results.AddValue(scalar.ScalarValue( | 80 results.AddValue(scalar.ScalarValue( |
| 86 results.current_page, 'record_time', 'ms', record_time)) | 81 results.current_page, 'record_time', 'ms', record_time)) |
| 87 | 82 |
| 88 record_time_sk_null_canvas = data['record_time_sk_null_canvas_ms'] | 83 record_time_sk_null_canvas = data['record_time_sk_null_canvas_ms'] |
| 89 record_time_painting_disabled = data['record_time_painting_disabled_ms'] | 84 record_time_painting_disabled = data['record_time_painting_disabled_ms'] |
| 90 # TODO(schenney): Remove this workaround when reference builds get past | 85 record_time_caching_disabled = data['record_time_caching_disabled_ms'] |
| 91 # the change that adds this comment. | |
| 92 record_time_caching_disabled = \ | |
| 93 data.get('record_time_caching_disabled_ms', 0) | |
| 94 # TODO(schenney): Remove this workaround when reference builds get past | |
| 95 # the change that adds this comment. | |
| 96 record_time_construction_disabled = \ | 86 record_time_construction_disabled = \ |
| 97 data.get('record_time_construction_disabled_ms', 0) | 87 data['record_time_construction_disabled_ms'] |
| 98 # TODO(wangxianzhu): Remove this workaround when reference builds get past | |
| 99 # the change that adds this comment. | |
| 100 record_time_subsequence_caching_disabled = \ | 88 record_time_subsequence_caching_disabled = \ |
| 101 data.get('record_time_subsequence_caching_disabled_ms', 0) | 89 data['record_time_subsequence_caching_disabled_ms'] |
| 102 results.AddValue(scalar.ScalarValue( | 90 results.AddValue(scalar.ScalarValue( |
| 103 results.current_page, 'record_time_sk_null_canvas', 'ms', | 91 results.current_page, 'record_time_sk_null_canvas', 'ms', |
| 104 record_time_sk_null_canvas)) | 92 record_time_sk_null_canvas)) |
| 105 results.AddValue(scalar.ScalarValue( | 93 results.AddValue(scalar.ScalarValue( |
| 106 results.current_page, 'record_time_painting_disabled', 'ms', | 94 results.current_page, 'record_time_painting_disabled', 'ms', |
| 107 record_time_painting_disabled)) | 95 record_time_painting_disabled)) |
| 108 results.AddValue(scalar.ScalarValue( | 96 results.AddValue(scalar.ScalarValue( |
| 109 results.current_page, 'record_time_caching_disabled', 'ms', | 97 results.current_page, 'record_time_caching_disabled', 'ms', |
| 110 record_time_caching_disabled)) | 98 record_time_caching_disabled)) |
| 111 results.AddValue(scalar.ScalarValue( | 99 results.AddValue(scalar.ScalarValue( |
| 112 results.current_page, 'record_time_construction_disabled', 'ms', | 100 results.current_page, 'record_time_construction_disabled', 'ms', |
| 113 record_time_construction_disabled)) | 101 record_time_construction_disabled)) |
| 114 results.AddValue(scalar.ScalarValue( | 102 results.AddValue(scalar.ScalarValue( |
| 115 results.current_page, 'record_time_subsequence_caching_disabled', 'ms', | 103 results.current_page, 'record_time_subsequence_caching_disabled', 'ms', |
| 116 record_time_subsequence_caching_disabled)) | 104 record_time_subsequence_caching_disabled)) |
| 117 | 105 |
| 118 if self._report_detailed_results: | 106 if self._report_detailed_results: |
| 119 pixels_rasterized_with_non_solid_color = \ | 107 pixels_rasterized_with_non_solid_color = \ |
| 120 data['pixels_rasterized_with_non_solid_color'] | 108 data['pixels_rasterized_with_non_solid_color'] |
| 121 pixels_rasterized_as_opaque = \ | 109 pixels_rasterized_as_opaque = \ |
| 122 data['pixels_rasterized_as_opaque'] | 110 data['pixels_rasterized_as_opaque'] |
| 123 total_layers = data['total_layers'] | 111 total_layers = data['total_layers'] |
| 124 total_picture_layers = data['total_picture_layers'] | 112 total_picture_layers = data['total_picture_layers'] |
| 125 total_picture_layers_with_no_content = \ | 113 total_picture_layers_with_no_content = \ |
| 126 data['total_picture_layers_with_no_content'] | 114 data['total_picture_layers_with_no_content'] |
| 127 total_picture_layers_off_screen = \ | 115 total_picture_layers_off_screen = \ |
| 128 data['total_picture_layers_off_screen'] | 116 data['total_picture_layers_off_screen'] |
| 129 # TODO(schenney): Remove this workaround when reference builds get past | 117 # TODO(wkorman): Why are we storing rasterize_results_.total_memory_usage |
| 130 # the change that adds this comment. | 118 # in a field called |total_pictures_in_pile_size|? Did we just repurpose |
| 131 if 'total_pictures_in_pile_size' in data: | 119 # that field to avoid having to rename/create another? |
| 132 total_pictures_in_pile_size = data['total_pictures_in_pile_size'] | 120 total_pictures_in_pile_size = data['total_pictures_in_pile_size'] |
| 133 else: | |
| 134 total_pictures_in_pile_size = 0 | |
| 135 | 121 |
| 136 results.AddValue(scalar.ScalarValue( | 122 results.AddValue(scalar.ScalarValue( |
| 137 results.current_page, 'total_size_of_pictures_in_piles', 'bytes', | 123 results.current_page, 'total_size_of_pictures_in_piles', 'bytes', |
| 138 total_pictures_in_pile_size)) | 124 total_pictures_in_pile_size)) |
| 139 results.AddValue(scalar.ScalarValue( | 125 results.AddValue(scalar.ScalarValue( |
| 140 results.current_page, 'pixels_rasterized_with_non_solid_color', | 126 results.current_page, 'pixels_rasterized_with_non_solid_color', |
| 141 'pixels', pixels_rasterized_with_non_solid_color)) | 127 'pixels', pixels_rasterized_with_non_solid_color)) |
| 142 results.AddValue(scalar.ScalarValue( | 128 results.AddValue(scalar.ScalarValue( |
| 143 results.current_page, 'pixels_rasterized_as_opaque', 'pixels', | 129 results.current_page, 'pixels_rasterized_as_opaque', 'pixels', |
| 144 pixels_rasterized_as_opaque)) | 130 pixels_rasterized_as_opaque)) |
| 145 results.AddValue(scalar.ScalarValue( | 131 results.AddValue(scalar.ScalarValue( |
| 146 results.current_page, 'total_layers', 'count', total_layers)) | 132 results.current_page, 'total_layers', 'count', total_layers)) |
| 147 results.AddValue(scalar.ScalarValue( | 133 results.AddValue(scalar.ScalarValue( |
| 148 results.current_page, 'total_picture_layers', 'count', | 134 results.current_page, 'total_picture_layers', 'count', |
| 149 total_picture_layers)) | 135 total_picture_layers)) |
| 150 results.AddValue(scalar.ScalarValue( | 136 results.AddValue(scalar.ScalarValue( |
| 151 results.current_page, 'total_picture_layers_with_no_content', 'count', | 137 results.current_page, 'total_picture_layers_with_no_content', 'count', |
| 152 total_picture_layers_with_no_content)) | 138 total_picture_layers_with_no_content)) |
| 153 results.AddValue(scalar.ScalarValue( | 139 results.AddValue(scalar.ScalarValue( |
| 154 results.current_page, 'total_picture_layers_off_screen', 'count', | 140 results.current_page, 'total_picture_layers_off_screen', 'count', |
| 155 total_picture_layers_off_screen)) | 141 total_picture_layers_off_screen)) |
| OLD | NEW |