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

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

Issue 17757002: Add UMA/Telemetry stats for touch event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move ACKED_COMPONENT && ComputeTouchLatency() to TouchEventQueue ; Merge FindLatency() with ToT Has… Created 7 years, 5 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 (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 from perf_tools import smoothness_metrics 4 from perf_tools import smoothness_metrics
5 from telemetry.core import util 5 from telemetry.core import util
6 from telemetry.page import page_measurement 6 from telemetry.page import page_measurement
7 7
8 class DidNotScrollException(page_measurement.MeasurementFailure): 8 class DidNotScrollException(page_measurement.MeasurementFailure):
9 def __init__(self): 9 def __init__(self):
10 super(DidNotScrollException, self).__init__('Page did not scroll') 10 super(DidNotScrollException, self).__init__('Page did not scroll')
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 results.Add('total_tiles_analyzed', 'count', 135 results.Add('total_tiles_analyzed', 'count',
136 totalTilesAnalyzed, 136 totalTilesAnalyzed,
137 data_type='unimportant') 137 data_type='unimportant')
138 results.Add('solid_color_tiles_analyzed', 'count', 138 results.Add('solid_color_tiles_analyzed', 'count',
139 solidColorTilesAnalyzed, 139 solidColorTilesAnalyzed,
140 data_type='unimportant') 140 data_type='unimportant')
141 results.Add('average_tile_analysis_time', 'ms', 141 results.Add('average_tile_analysis_time', 'ms',
142 averageAnalysisTimeMS, 142 averageAnalysisTimeMS,
143 data_type='unimportant') 143 data_type='unimportant')
144 144
145 def CalcLatency(rendering_stats_deltas, count_name, total_latency_name,
146 result_name, results):
147 eventCount = rendering_stats_deltas.get(count_name, 0)
148 totalLatencyInSeconds = rendering_stats_deltas.get(total_latency_name, 0)
149 averageLatency = DivideIfPossibleOrZero(
150 (totalLatencyInSeconds * 1000), eventCount)
151 results.Add(result_name, 'ms', averageLatency, data_type='unimportant')
152
145 def CalcLatencyResults(rendering_stats_deltas, results): 153 def CalcLatencyResults(rendering_stats_deltas, results):
146 inputEventCount = rendering_stats_deltas.get( 154 CalcLatency(rendering_stats_deltas, 'inputEventCount', 'totalInputLatency',
147 'inputEventCount', 0) 155 'average_latency', results)
148 totalInputLatencyInSeconds = rendering_stats_deltas.get( 156 CalcLatency(rendering_stats_deltas, 'touchUICount', 'totalTouchUILatency',
149 'totalInputLatency', 0) 157 'average_touch_ui_latency', results)
150 158 CalcLatency(rendering_stats_deltas, 'touchAckedCount',
151 averageLatency = DivideIfPossibleOrZero( 159 'totalTouchAckedLatency',
152 (totalInputLatencyInSeconds * 1000), inputEventCount) 160 'average_touch_acked_latency',
153 161 results)
154 results.Add('average_latency', 'ms', averageLatency,
155 data_type='unimportant')
156
157 162
158 class Smoothness(page_measurement.PageMeasurement): 163 class Smoothness(page_measurement.PageMeasurement):
159 def __init__(self): 164 def __init__(self):
160 super(Smoothness, self).__init__('smoothness') 165 super(Smoothness, self).__init__('smoothness')
161 self.force_enable_threaded_compositing = False 166 self.force_enable_threaded_compositing = False
162 self.use_gpu_benchmarking_extension = True 167 self.use_gpu_benchmarking_extension = True
163 self._metrics = None 168 self._metrics = None
164 169
165 def AddCommandLineOptions(self, parser): 170 def AddCommandLineOptions(self, parser):
166 parser.add_option('--report-all-results', dest='report_all_results', 171 parser.add_option('--report-all-results', dest='report_all_results',
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 222
218 if self.options.report_all_results: 223 if self.options.report_all_results:
219 for k, v in rendering_stats_deltas.iteritems(): 224 for k, v in rendering_stats_deltas.iteritems():
220 results.Add(k, '', v) 225 results.Add(k, '', v)
221 226
222 if tab.browser.platform.IsRawDisplayFrameRateSupported(): 227 if tab.browser.platform.IsRawDisplayFrameRateSupported():
223 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): 228 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
224 if not r.value: 229 if not r.value:
225 raise MissingDisplayFrameRate() 230 raise MissingDisplayFrameRate()
226 results.Add(r.name, r.unit, r.value) 231 results.Add(r.name, r.unit, r.value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698