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

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

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 years, 11 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
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 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
11 from telemetry.value import improvement_direction
11 from telemetry.value import scalar 12 from telemetry.value import scalar
12 13
13 14
14 class ImageDecoding(page_test.PageTest): 15 class ImageDecoding(page_test.PageTest):
15 def __init__(self): 16 def __init__(self):
16 super(ImageDecoding, self).__init__( 17 super(ImageDecoding, self).__init__(
17 action_name_to_run='RunPageInteractions') 18 action_name_to_run='RunPageInteractions')
18 self._power_metric = None 19 self._power_metric = None
19 20
20 def CustomizeBrowserOptions(self, options): 21 def CustomizeBrowserOptions(self, options):
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 decode_image_events = decode_image_events[-min_iterations:] 88 decode_image_events = decode_image_events[-min_iterations:]
88 89
89 durations = [d.duration for d in decode_image_events] 90 durations = [d.duration for d in decode_image_events]
90 assert durations, 'Failed to find image decode trace events.' 91 assert durations, 'Failed to find image decode trace events.'
91 92
92 image_decoding_avg = sum(durations) / len(durations) 93 image_decoding_avg = sum(durations) / len(durations)
93 results.AddValue(scalar.ScalarValue( 94 results.AddValue(scalar.ScalarValue(
94 results.current_page, 'ImageDecoding_avg', 'ms', image_decoding_avg, 95 results.current_page, 'ImageDecoding_avg', 'ms', image_decoding_avg,
95 description='Average decode time for images in 4 different ' 96 description='Average decode time for images in 4 different '
96 'formats: gif, png, jpg, and webp. The image files are ' 97 'formats: gif, png, jpg, and webp. The image files are '
97 'located at chrome/test/data/image_decoding.')) 98 'located at chrome/test/data/image_decoding.',
99 improvement_direction=improvement_direction.DOWN))
98 results.AddValue(scalar.ScalarValue( 100 results.AddValue(scalar.ScalarValue(
99 results.current_page, 'ImageLoading_avg', 'ms', 101 results.current_page, 'ImageLoading_avg', 'ms',
100 tab.EvaluateJavaScript('averageLoadingTimeMs()'))) 102 tab.EvaluateJavaScript('averageLoadingTimeMs()'),
103 improvement_direction=improvement_direction.DOWN))
101 104
102 def CleanUpAfterPage(self, page, tab): 105 def CleanUpAfterPage(self, page, tab):
103 tracing_controller = tab.browser.platform.tracing_controller 106 tracing_controller = tab.browser.platform.tracing_controller
104 if tracing_controller.is_tracing_running: 107 if tracing_controller.is_tracing_running:
105 tracing_controller.Stop() 108 tracing_controller.Stop()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698