| 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 from telemetry.page import page_test |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 except TimeoutException: | 61 except TimeoutException: |
| 62 pass | 62 pass |
| 63 time.sleep(self.options.start_wait_time) | 63 time.sleep(self.options.start_wait_time) |
| 64 | 64 |
| 65 record_repeat = self.options.record_repeat | 65 record_repeat = self.options.record_repeat |
| 66 rasterize_repeat = self.options.rasterize_repeat | 66 rasterize_repeat = self.options.rasterize_repeat |
| 67 # Enqueue benchmark | 67 # Enqueue benchmark |
| 68 tab.ExecuteJavaScript(""" | 68 tab.ExecuteJavaScript(""" |
| 69 window.benchmark_results = {}; | 69 window.benchmark_results = {}; |
| 70 window.benchmark_results.done = false; | 70 window.benchmark_results.done = false; |
| 71 window.benchmark_results.scheduled = | 71 window.benchmark_results.id = |
| 72 chrome.gpuBenchmarking.runMicroBenchmark( | 72 chrome.gpuBenchmarking.runMicroBenchmark( |
| 73 "rasterize_and_record_benchmark", | 73 "rasterize_and_record_benchmark", |
| 74 function(value) { | 74 function(value) { |
| 75 window.benchmark_results.done = true; | 75 window.benchmark_results.done = true; |
| 76 window.benchmark_results.results = value; | 76 window.benchmark_results.results = value; |
| 77 }, { | 77 }, { |
| 78 "record_repeat_count": """ + str(record_repeat) + """, | 78 "record_repeat_count": """ + str(record_repeat) + """, |
| 79 "rasterize_repeat_count": """ + str(rasterize_repeat) + """ | 79 "rasterize_repeat_count": """ + str(rasterize_repeat) + """ |
| 80 }); | 80 }); |
| 81 """) | 81 """) |
| 82 | 82 |
| 83 scheduled = tab.EvaluateJavaScript('window.benchmark_results.scheduled') | 83 benchmark_id = tab.EvaluateJavaScript('window.benchmark_results.id') |
| 84 if (not scheduled): | 84 if (not benchmark_id): |
| 85 raise page_measurement.MeasurementFailure( | 85 raise page_measurement.MeasurementFailure( |
| 86 'Failed to schedule rasterize_and_record_micro') | 86 'Failed to schedule rasterize_and_record_micro') |
| 87 | 87 |
| 88 tab.WaitForJavaScriptExpression( | 88 tab.WaitForJavaScriptExpression( |
| 89 'window.benchmark_results.done', self.options.timeout) | 89 'window.benchmark_results.done', self.options.timeout) |
| 90 | 90 |
| 91 data = tab.EvaluateJavaScript('window.benchmark_results.results') | 91 data = tab.EvaluateJavaScript('window.benchmark_results.results') |
| 92 | 92 |
| 93 pixels_recorded = data['pixels_recorded'] | 93 pixels_recorded = data['pixels_recorded'] |
| 94 record_time = data['record_time_ms'] | 94 record_time = data['record_time_ms'] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', | 128 results.Add('pixels_rasterized_with_non_solid_color', 'pixels', |
| 129 pixels_rasterized_with_non_solid_color) | 129 pixels_rasterized_with_non_solid_color) |
| 130 results.Add('pixels_rasterized_as_opaque', 'pixels', | 130 results.Add('pixels_rasterized_as_opaque', 'pixels', |
| 131 pixels_rasterized_as_opaque) | 131 pixels_rasterized_as_opaque) |
| 132 results.Add('total_layers', 'count', total_layers) | 132 results.Add('total_layers', 'count', total_layers) |
| 133 results.Add('total_picture_layers', 'count', total_picture_layers) | 133 results.Add('total_picture_layers', 'count', total_picture_layers) |
| 134 results.Add('total_picture_layers_with_no_content', 'count', | 134 results.Add('total_picture_layers_with_no_content', 'count', |
| 135 total_picture_layers_with_no_content) | 135 total_picture_layers_with_no_content) |
| 136 results.Add('total_picture_layers_off_screen', 'count', | 136 results.Add('total_picture_layers_off_screen', 'count', |
| 137 total_picture_layers_off_screen) | 137 total_picture_layers_off_screen) |
| OLD | NEW |