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

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

Issue 391183002: Delete trace-info.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed descriptions in smoothness_controller. Created 6 years, 4 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 | « tools/perf/measurements/page_cycler.py ('k') | tools/perf/metrics/iometric.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import sys 4 import sys
5 5
6 from measurements import smooth_gesture_util 6 from measurements import smooth_gesture_util
7 from telemetry.timeline.model import TimelineModel 7 from telemetry.timeline.model import TimelineModel
8 from telemetry.page import page_measurement 8 from telemetry.page import page_measurement
9 from telemetry.page.actions import action_runner 9 from telemetry.page.actions import action_runner
10 from telemetry.value import list_of_scalar_values 10 from telemetry.value import list_of_scalar_values
11 from telemetry.value import scalar 11 from telemetry.value import scalar
12 from telemetry.web_perf import timeline_interaction_record as tir_module 12 from telemetry.web_perf import timeline_interaction_record as tir_module
13 from telemetry.web_perf.metrics import smoothness 13 from telemetry.web_perf.metrics import smoothness
14 14
15 15
16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' 16 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions'
17 17
18 # Descriptions for results from platform.GetRawDisplayFrameRateMeasurements().
19 DESCRIPTIONS = {
20 'avg_surface_fps': 'Average frames per second as measured by the '
21 'platform\'s SurfaceFlinger.'
22 }
23
18 24
19 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): 25 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure):
20 def __init__(self, name): 26 def __init__(self, name):
21 super(MissingDisplayFrameRateError, self).__init__( 27 super(MissingDisplayFrameRateError, self).__init__(
22 'Missing display frame rate metrics: ' + name) 28 'Missing display frame rate metrics: ' + name)
23 29
24 class SmoothnessController(object): 30 class SmoothnessController(object):
25 def __init__(self): 31 def __init__(self):
26 self._timeline_model = None 32 self._timeline_model = None
27 self._tracing_timeline_data = None 33 self._tracing_timeline_data = None
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if run_smooth_actions_record is None: 89 if run_smooth_actions_record is None:
84 sys.stderr.write('Raw tracing data:\n') 90 sys.stderr.write('Raw tracing data:\n')
85 sys.stderr.write(repr(self._tracing_timeline_data.EventData())) 91 sys.stderr.write(repr(self._tracing_timeline_data.EventData()))
86 sys.stderr.write('\n') 92 sys.stderr.write('\n')
87 raise Exception('SmoothnessController failed to issue markers for the ' 93 raise Exception('SmoothnessController failed to issue markers for the '
88 'whole interaction.') 94 'whole interaction.')
89 else: 95 else:
90 smooth_records = [run_smooth_actions_record] 96 smooth_records = [run_smooth_actions_record]
91 97
92 # Create an interaction_record for this legacy measurement. Since we don't 98 # Create an interaction_record for this legacy measurement. Since we don't
93 # wrap the results that is sent to smoothnes metric, the label will 99 # wrap the results that are sent to smoothness metric, the label will
94 # not be used. 100 # not be used.
95 smoothness_metric = smoothness.SmoothnessMetric() 101 smoothness_metric = smoothness.SmoothnessMetric()
96 smoothness_metric.AddResults( 102 smoothness_metric.AddResults(
97 self._timeline_model, renderer_thread, smooth_records, results) 103 self._timeline_model, renderer_thread, smooth_records, results)
98 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 104 if tab.browser.platform.IsRawDisplayFrameRateSupported():
99 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 105 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
100 if r.value is None: 106 if r.value is None:
101 raise MissingDisplayFrameRateError(r.name) 107 raise MissingDisplayFrameRateError(r.name)
102 if isinstance(r.value, list): 108 if isinstance(r.value, list):
103 results.AddValue(list_of_scalar_values.ListOfScalarValues( 109 results.AddValue(list_of_scalar_values.ListOfScalarValues(
104 results.current_page, r.name, r.unit, r.value)) 110 results.current_page, r.name, r.unit, r.value,
111 description=DESCRIPTIONS.get(r.name)))
105 else: 112 else:
106 results.AddValue(scalar.ScalarValue( 113 results.AddValue(scalar.ScalarValue(
107 results.current_page, r.name, r.unit, r.value)) 114 results.current_page, r.name, r.unit, r.value,
115 description=DESCRIPTIONS.get(r.name)))
108 116
109 def CleanUp(self, tab): 117 def CleanUp(self, tab):
110 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 118 if tab.browser.platform.IsRawDisplayFrameRateSupported():
111 tab.browser.platform.StopRawDisplayFrameRateMeasurement() 119 tab.browser.platform.StopRawDisplayFrameRateMeasurement()
112 if tab.browser.is_tracing_running: 120 if tab.browser.is_tracing_running:
113 tab.browser.StopTracing() 121 tab.browser.StopTracing()
OLDNEW
« no previous file with comments | « tools/perf/measurements/page_cycler.py ('k') | tools/perf/metrics/iometric.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698