Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: tools/perf/measurements/image_decoding.py

Issue 376933003: Update image_decoding to use results.AddValue(...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 from telemetry.page import page_measurement 6 from telemetry.page import page_measurement
7 from telemetry.timeline import model 7 from telemetry.timeline import model
8 from telemetry.value import scalar
8 9
9 10
10 class ImageDecoding(page_measurement.PageMeasurement): 11 class ImageDecoding(page_measurement.PageMeasurement):
11 def __init__(self): 12 def __init__(self):
12 super(ImageDecoding, self).__init__() 13 super(ImageDecoding, self).__init__()
13 self._power_metric = None 14 self._power_metric = None
14 15
15 def CustomizeBrowserOptions(self, options): 16 def CustomizeBrowserOptions(self, options):
16 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') 17 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
17 power.PowerMetric.CustomizeBrowserOptions(options) 18 power.PowerMetric.CustomizeBrowserOptions(options)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 'image_decoding_measurement_limit_results_to_min_iterations') and 61 'image_decoding_measurement_limit_results_to_min_iterations') and
61 page.image_decoding_measurement_limit_results_to_min_iterations): 62 page.image_decoding_measurement_limit_results_to_min_iterations):
62 assert _IsDone() 63 assert _IsDone()
63 min_iterations = tab.EvaluateJavaScript('minIterations') 64 min_iterations = tab.EvaluateJavaScript('minIterations')
64 decode_image_events = decode_image_events[-min_iterations:] 65 decode_image_events = decode_image_events[-min_iterations:]
65 66
66 durations = [d.duration for d in decode_image_events] 67 durations = [d.duration for d in decode_image_events]
67 assert durations, 'Failed to find "Decode Image" trace events.' 68 assert durations, 'Failed to find "Decode Image" trace events.'
68 69
69 image_decoding_avg = sum(durations) / len(durations) 70 image_decoding_avg = sum(durations) / len(durations)
70 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg) 71 results.AddValue(scalar.ScalarValue(
71 results.Add('ImageLoading_avg', 'ms', 72 results.current_page, 'ImageDecoding_avg', 'ms', image_decoding_avg))
72 tab.EvaluateJavaScript('averageLoadingTimeMs()')) 73 results.AddValue(scalar.ScalarValue(
74 results.current_page, 'ImageLoading_avg', 'ms',
75 tab.EvaluateJavaScript('averageLoadingTimeMs()')))
73 76
74 def CleanUpAfterPage(self, page, tab): 77 def CleanUpAfterPage(self, page, tab):
75 if tab.browser.is_tracing_running: 78 if tab.browser.is_tracing_running:
76 tab.browser.StopTracing() 79 tab.browser.StopTracing()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698