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

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

Issue 342993002: Allow blink.console or webkit.console in telemetry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « content/test/gpu/gpu_tests/memory.py ('k') | tools/perf/measurements/smoothness_controller.py » ('j') | 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 8
9 9
10 class ImageDecoding(page_measurement.PageMeasurement): 10 class ImageDecoding(page_measurement.PageMeasurement):
11 def __init__(self): 11 def __init__(self):
12 super(ImageDecoding, self).__init__() 12 super(ImageDecoding, self).__init__()
13 self._power_metric = power.PowerMetric() 13 self._power_metric = power.PowerMetric()
14 14
15 def CustomizeBrowserOptions(self, options): 15 def CustomizeBrowserOptions(self, options):
16 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') 16 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
17 power.PowerMetric.CustomizeBrowserOptions(options) 17 power.PowerMetric.CustomizeBrowserOptions(options)
18 18
19 def WillNavigateToPage(self, page, tab): 19 def WillNavigateToPage(self, page, tab):
20 tab.ExecuteJavaScript(""" 20 tab.ExecuteJavaScript("""
21 if (window.chrome && 21 if (window.chrome &&
22 chrome.gpuBenchmarking && 22 chrome.gpuBenchmarking &&
23 chrome.gpuBenchmarking.clearImageCache) { 23 chrome.gpuBenchmarking.clearImageCache) {
24 chrome.gpuBenchmarking.clearImageCache(); 24 chrome.gpuBenchmarking.clearImageCache();
25 } 25 }
26 """) 26 """)
27 self._power_metric.Start(page, tab) 27 self._power_metric.Start(page, tab)
28 # FIXME: bare 'devtools' is for compatibility with older reference versions 28 # FIXME: bare 'devtools' is for compatibility with older reference versions
29 # only and may eventually be removed. 29 # only and may eventually be removed.
30 # FIXME: Remove webkit.console when blink.console lands in chromium and
31 # the ref builds are updated. crbug.com/386847
30 tab.browser.StartTracing( 32 tab.browser.StartTracing(
31 'disabled-by-default-devtools.timeline*,devtools,webkit.console') 33 'disabled-by-default-devtools.timeline*,' +
34 'devtools,webkit.console,blink.console')
32 35
33 def StopBrowserAfterPage(self, browser, page): 36 def StopBrowserAfterPage(self, browser, page):
34 return not browser.tabs[0].ExecuteJavaScript(""" 37 return not browser.tabs[0].ExecuteJavaScript("""
35 window.chrome && 38 window.chrome &&
36 chrome.gpuBenchmarking && 39 chrome.gpuBenchmarking &&
37 chrome.gpuBenchmarking.clearImageCache; 40 chrome.gpuBenchmarking.clearImageCache;
38 """) 41 """)
39 42
40 def MeasurePage(self, page, tab, results): 43 def MeasurePage(self, page, tab, results):
41 timeline_data = tab.browser.StopTracing() 44 timeline_data = tab.browser.StopTracing()
(...skipping 19 matching lines...) Expand all
61 assert durations, 'Failed to find "Decode Image" trace events.' 64 assert durations, 'Failed to find "Decode Image" trace events.'
62 65
63 image_decoding_avg = sum(durations) / len(durations) 66 image_decoding_avg = sum(durations) / len(durations)
64 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg) 67 results.Add('ImageDecoding_avg', 'ms', image_decoding_avg)
65 results.Add('ImageLoading_avg', 'ms', 68 results.Add('ImageLoading_avg', 'ms',
66 tab.EvaluateJavaScript('averageLoadingTimeMs()')) 69 tab.EvaluateJavaScript('averageLoadingTimeMs()'))
67 70
68 def CleanUpAfterPage(self, page, tab): 71 def CleanUpAfterPage(self, page, tab):
69 if tab.browser.is_tracing_running: 72 if tab.browser.is_tracing_running:
70 tab.browser.StopTracing() 73 tab.browser.StopTracing()
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/memory.py ('k') | tools/perf/measurements/smoothness_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698