OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 from telemetry.page import page_measurement | 6 from telemetry.page import page_measurement |
7 from telemetry.core.timeline import model | 7 from telemetry.core.timeline import model |
8 | 8 |
9 | 9 |
10 class ImageDecoding(page_measurement.PageMeasurement): | 10 class ImageDecoding(page_measurement.PageMeasurement): |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 min_iterations = tab.EvaluateJavaScript('minIterations') | 55 min_iterations = tab.EvaluateJavaScript('minIterations') |
56 decode_image_events = decode_image_events[-min_iterations:] | 56 decode_image_events = decode_image_events[-min_iterations:] |
57 | 57 |
58 durations = [d.duration for d in decode_image_events] | 58 durations = [d.duration for d in decode_image_events] |
59 if not durations: | 59 if not durations: |
60 return | 60 return |
61 image_decoding_avg = sum(durations) / len(durations) | 61 image_decoding_avg = sum(durations) / len(durations) |
62 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg) | 62 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg) |
63 results.Add('ImageLoading_avg', 'ms', | 63 results.Add('ImageLoading_avg', 'ms', |
64 tab.EvaluateJavaScript('averageLoadingTimeMs()')) | 64 tab.EvaluateJavaScript('averageLoadingTimeMs()')) |
| 65 |
| 66 def CleanUpAfterPage(self, page, tab): |
| 67 if tab.browser.is_tracing_running: |
| 68 tab.browser.StopTracing() |
OLD | NEW |