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

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

Issue 51103014: telemetry: re-enable smoothness.tough_canvas_cases on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 import sys
6
7 from metrics import smoothness 5 from metrics import smoothness
8 from metrics import timeline 6 from metrics import timeline
9 from telemetry.page import page_test 7 from telemetry.page import page_test
10 from telemetry.page import page_measurement 8 from telemetry.page import page_measurement
11 9
12 10
13 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): 11 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure):
14 def __init__(self, name): 12 def __init__(self, name):
15 super(MissingDisplayFrameRateError, self).__init__( 13 super(MissingDisplayFrameRateError, self).__init__(
16 'Missing display frame rate metrics: ' + name) 14 'Missing display frame rate metrics: ' + name)
17 15
18 16
19 class Smoothness(page_measurement.PageMeasurement): 17 class Smoothness(page_measurement.PageMeasurement):
20 def __init__(self): 18 def __init__(self):
21 super(Smoothness, self).__init__('smoothness') 19 super(Smoothness, self).__init__('smoothness')
22 self._trace_result = None 20 self._trace_result = None
23 self._metric = None 21 self._metric = None
24 22
25 def AddCommandLineOptions(self, parser): 23 def AddCommandLineOptions(self, parser):
26 metric_choices = ['smoothness', 'timeline'] 24 metric_choices = ['smoothness', 'timeline']
27 parser.add_option('--metric', dest='metric', type='choice', 25 parser.add_option('--metric', dest='metric', type='choice',
28 choices=metric_choices, 26 choices=metric_choices,
29 default='smoothness', 27 default='smoothness',
30 help=('Metric to use in the measurement. ' + 28 help=('Metric to use in the measurement. ' +
31 'Supported values: ' + ', '.join(metric_choices))) 29 'Supported values: ' + ', '.join(metric_choices)))
32 30
33 def CustomizeBrowserOptions(self, options): 31 def CustomizeBrowserOptions(self, options):
34 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') 32 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
35 33
36 # smoothness.tough_canvas_cases fails on Android.
37 # TODO(ernstm): Re-enable this test when crbug.com/311582 is fixed.
38 if (sys.platform == 'android' and
39 (sys.argv[-1].endswith('tough_canvas_cases'))):
40 print '%s is currently disabled on Android. Skipping test.' % sys.argv[-1]
41 sys.exit(0)
42
43 def CanRunForPage(self, page): 34 def CanRunForPage(self, page):
44 return hasattr(page, 'smoothness') 35 return hasattr(page, 'smoothness')
45 36
46 def WillRunAction(self, page, tab, action): 37 def WillRunAction(self, page, tab, action):
47 if self.options.metric == 'smoothness': 38 if self.options.metric == 'smoothness':
48 compound_action = page_test.GetCompoundActionFromPage( 39 compound_action = page_test.GetCompoundActionFromPage(
49 page, self._action_name_to_run) 40 page, self._action_name_to_run)
50 self._metric = smoothness.SmoothnessMetric(compound_action) 41 self._metric = smoothness.SmoothnessMetric(compound_action)
51 elif self.options.metric == 'timeline': 42 elif self.options.metric == 'timeline':
52 self._metric = timeline.TimelineMetric(timeline.TRACING_MODE) 43 self._metric = timeline.TimelineMetric(timeline.TRACING_MODE)
53 44
54 self._metric.Start(page, tab) 45 self._metric.Start(page, tab)
55 46
56 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 47 if tab.browser.platform.IsRawDisplayFrameRateSupported():
57 tab.browser.platform.StartRawDisplayFrameRateMeasurement() 48 tab.browser.platform.StartRawDisplayFrameRateMeasurement()
58 49
59 def DidRunAction(self, page, tab, action): 50 def DidRunAction(self, page, tab, action):
60 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 51 if tab.browser.platform.IsRawDisplayFrameRateSupported():
61 tab.browser.platform.StopRawDisplayFrameRateMeasurement() 52 tab.browser.platform.StopRawDisplayFrameRateMeasurement()
62 self._metric.Stop(page, tab) 53 self._metric.Stop(page, tab)
63 54
64 def MeasurePage(self, page, tab, results): 55 def MeasurePage(self, page, tab, results):
65 self._metric.AddResults(tab, results) 56 self._metric.AddResults(tab, results)
66 57
67 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 58 if tab.browser.platform.IsRawDisplayFrameRateSupported():
68 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 59 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
69 if r.value is None: 60 if r.value is None:
70 raise MissingDisplayFrameRateError(r.name) 61 raise MissingDisplayFrameRateError(r.name)
71 results.Add(r.name, r.unit, r.value) 62 results.Add(r.name, r.unit, r.value)
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