OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 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 from metrics import power | 5 from metrics import power |
6 | 6 |
7 from telemetry.core.platform import tracing_category_filter | 7 from telemetry.core.platform import tracing_category_filter |
8 from telemetry.core.platform import tracing_options | 8 from telemetry.core.platform import tracing_options |
9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
10 from telemetry.timeline import model | 10 from telemetry.timeline import model |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 decode_image_events = decode_image_events[-min_iterations:] | 86 decode_image_events = decode_image_events[-min_iterations:] |
87 | 87 |
88 durations = [d.duration for d in decode_image_events] | 88 durations = [d.duration for d in decode_image_events] |
89 assert durations, 'Failed to find image decode trace events.' | 89 assert durations, 'Failed to find image decode trace events.' |
90 | 90 |
91 image_decoding_avg = sum(durations) / len(durations) | 91 image_decoding_avg = sum(durations) / len(durations) |
92 results.AddValue(scalar.ScalarValue( | 92 results.AddValue(scalar.ScalarValue( |
93 results.current_page, 'ImageDecoding_avg', 'ms', image_decoding_avg, | 93 results.current_page, 'ImageDecoding_avg', 'ms', image_decoding_avg, |
94 description='Average decode time for images in 4 different ' | 94 description='Average decode time for images in 4 different ' |
95 'formats: gif, png, jpg, and webp. The image files are ' | 95 'formats: gif, png, jpg, and webp. The image files are ' |
96 'located at chrome/test/data/image_decoding.')) | 96 'located at chrome/test/data/image_decoding.', |
| 97 higher_is_better=False)) |
97 results.AddValue(scalar.ScalarValue( | 98 results.AddValue(scalar.ScalarValue( |
98 results.current_page, 'ImageLoading_avg', 'ms', | 99 results.current_page, 'ImageLoading_avg', 'ms', |
99 tab.EvaluateJavaScript('averageLoadingTimeMs()'))) | 100 tab.EvaluateJavaScript('averageLoadingTimeMs()'), |
| 101 higher_is_better=False)) |
100 | 102 |
101 def CleanUpAfterPage(self, page, tab): | 103 def CleanUpAfterPage(self, page, tab): |
102 tracing_controller = tab.browser.platform.tracing_controller | 104 tracing_controller = tab.browser.platform.tracing_controller |
103 if tracing_controller.is_tracing_running: | 105 if tracing_controller.is_tracing_running: |
104 tracing_controller.Stop() | 106 tracing_controller.Stop() |
OLD | NEW |