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

Side by Side Diff: tools/perf/perf_tools/image_decoding_measurement.py

Issue 17413018: Fix image_decoding_measurement after r207556 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« 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 (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 telemetry.page import page_measurement 5 from telemetry.page import page_measurement
6 6
7 7
8 class ImageDecoding(page_measurement.PageMeasurement): 8 class ImageDecoding(page_measurement.PageMeasurement):
9 def CustomizeBrowserOptions(self, options): 9 def CustomizeBrowserOptions(self, options):
10 options.extra_browser_args.append('--enable-gpu-benchmarking') 10 options.extra_browser_args.append('--enable-gpu-benchmarking')
(...skipping 14 matching lines...) Expand all
25 chrome.gpuBenchmarking && 25 chrome.gpuBenchmarking &&
26 chrome.gpuBenchmarking.clearImageCache; 26 chrome.gpuBenchmarking.clearImageCache;
27 """) 27 """)
28 28
29 def MeasurePage(self, page, tab, results): 29 def MeasurePage(self, page, tab, results):
30 tab.StopTimelineRecording() 30 tab.StopTimelineRecording()
31 def _IsDone(): 31 def _IsDone():
32 return tab.EvaluateJavaScript('isDone') 32 return tab.EvaluateJavaScript('isDone')
33 33
34 decode_image_events = \ 34 decode_image_events = \
35 tab.timeline_model.GetAllOfName('DecodeImage') 35 tab.timeline_model.GetAllEventsOfName('DecodeImage')
36 36
37 # If it is a real image page, then store only the last-minIterations 37 # If it is a real image page, then store only the last-minIterations
38 # decode tasks. 38 # decode tasks.
39 if (hasattr(page, 39 if (hasattr(page,
40 'image_decoding_measurement_limit_results_to_min_iterations') and 40 'image_decoding_measurement_limit_results_to_min_iterations') and
41 page.image_decoding_measurement_limit_results_to_min_iterations): 41 page.image_decoding_measurement_limit_results_to_min_iterations):
42 assert _IsDone() 42 assert _IsDone()
43 min_iterations = tab.EvaluateJavaScript('minIterations') 43 min_iterations = tab.EvaluateJavaScript('minIterations')
44 decode_image_events = decode_image_events[-min_iterations:] 44 decode_image_events = decode_image_events[-min_iterations:]
45 45
46 durations = [d.duration for d in decode_image_events] 46 durations = [d.duration for d in decode_image_events]
47 if not durations: 47 if not durations:
48 results.Add('ImageDecoding_avg', 'ms', 'unsupported') 48 results.Add('ImageDecoding_avg', 'ms', 'unsupported')
49 return 49 return
50 image_decoding_avg = sum(durations) / len(durations) 50 image_decoding_avg = sum(durations) / len(durations)
51 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg) 51 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg)
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