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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 def ValidateAndMeasurePage(self, page, tab, results): | 29 def ValidateAndMeasurePage(self, page, tab, results): |
30 del page # unused | 30 del page # unused |
31 try: | 31 try: |
32 tab.WaitForDocumentReadyStateToBeComplete() | 32 tab.WaitForDocumentReadyStateToBeComplete() |
33 except py_utils.TimeoutException: | 33 except py_utils.TimeoutException: |
34 pass | 34 pass |
35 time.sleep(self._start_wait_time) | 35 time.sleep(self._start_wait_time) |
36 | 36 |
37 # Enqueue benchmark | 37 # Enqueue benchmark |
38 tab.ExecuteJavaScript2(""" | 38 tab.ExecuteJavaScript(""" |
39 window.benchmark_results = {}; | 39 window.benchmark_results = {}; |
40 window.benchmark_results.done = false; | 40 window.benchmark_results.done = false; |
41 window.benchmark_results.id = | 41 window.benchmark_results.id = |
42 chrome.gpuBenchmarking.runMicroBenchmark( | 42 chrome.gpuBenchmarking.runMicroBenchmark( |
43 "rasterize_and_record_benchmark", | 43 "rasterize_and_record_benchmark", |
44 function(value) { | 44 function(value) { |
45 window.benchmark_results.done = true; | 45 window.benchmark_results.done = true; |
46 window.benchmark_results.results = value; | 46 window.benchmark_results.results = value; |
47 }, { | 47 }, { |
48 "record_repeat_count": {{ record_repeat_count }}, | 48 "record_repeat_count": {{ record_repeat_count }}, |
49 "rasterize_repeat_count": {{ rasterize_repeat_count }} | 49 "rasterize_repeat_count": {{ rasterize_repeat_count }} |
50 }); | 50 }); |
51 """, | 51 """, |
52 record_repeat_count=self._record_repeat, | 52 record_repeat_count=self._record_repeat, |
53 rasterize_repeat_count=self._rasterize_repeat) | 53 rasterize_repeat_count=self._rasterize_repeat) |
54 | 54 |
55 # Evaluating this expression usually takes between 60 and 90 seconds. | 55 # Evaluating this expression usually takes between 60 and 90 seconds. |
56 benchmark_id = tab.EvaluateJavaScript2( | 56 benchmark_id = tab.EvaluateJavaScript( |
57 'window.benchmark_results.id', timeout=self._timeout) | 57 'window.benchmark_results.id', timeout=self._timeout) |
58 if not benchmark_id: | 58 if not benchmark_id: |
59 raise legacy_page_test.MeasurementFailure( | 59 raise legacy_page_test.MeasurementFailure( |
60 'Failed to schedule rasterize_and_record_micro') | 60 'Failed to schedule rasterize_and_record_micro') |
61 | 61 |
62 tab.WaitForJavaScriptCondition2( | 62 tab.WaitForJavaScriptCondition( |
63 'window.benchmark_results.done', timeout=self._timeout) | 63 'window.benchmark_results.done', timeout=self._timeout) |
64 | 64 |
65 data = tab.EvaluateJavaScript2('window.benchmark_results.results') | 65 data = tab.EvaluateJavaScript('window.benchmark_results.results') |
66 | 66 |
67 pixels_recorded = data['pixels_recorded'] | 67 pixels_recorded = data['pixels_recorded'] |
68 record_time = data['record_time_ms'] | 68 record_time = data['record_time_ms'] |
69 pixels_rasterized = data['pixels_rasterized'] | 69 pixels_rasterized = data['pixels_rasterized'] |
70 rasterize_time = data['rasterize_time_ms'] | 70 rasterize_time = data['rasterize_time_ms'] |
71 picture_memory_usage = data['picture_memory_usage'] | 71 picture_memory_usage = data['picture_memory_usage'] |
72 | 72 |
73 results.AddValue(scalar.ScalarValue( | 73 results.AddValue(scalar.ScalarValue( |
74 results.current_page, 'pixels_recorded', 'pixels', pixels_recorded)) | 74 results.current_page, 'pixels_recorded', 'pixels', pixels_recorded)) |
75 results.AddValue(scalar.ScalarValue( | 75 results.AddValue(scalar.ScalarValue( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 results.current_page, 'total_layers', 'count', total_layers)) | 139 results.current_page, 'total_layers', 'count', total_layers)) |
140 results.AddValue(scalar.ScalarValue( | 140 results.AddValue(scalar.ScalarValue( |
141 results.current_page, 'total_picture_layers', 'count', | 141 results.current_page, 'total_picture_layers', 'count', |
142 total_picture_layers)) | 142 total_picture_layers)) |
143 results.AddValue(scalar.ScalarValue( | 143 results.AddValue(scalar.ScalarValue( |
144 results.current_page, 'total_picture_layers_with_no_content', 'count', | 144 results.current_page, 'total_picture_layers_with_no_content', 'count', |
145 total_picture_layers_with_no_content)) | 145 total_picture_layers_with_no_content)) |
146 results.AddValue(scalar.ScalarValue( | 146 results.AddValue(scalar.ScalarValue( |
147 results.current_page, 'total_picture_layers_off_screen', 'count', | 147 results.current_page, 'total_picture_layers_off_screen', 'count', |
148 total_picture_layers_off_screen)) | 148 total_picture_layers_off_screen)) |
OLD | NEW |