Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 'inputEventCount', 0) | 147 'inputEventCount', 0) |
| 148 totalInputLatencyInSeconds = rendering_stats_deltas.get( | 148 totalInputLatencyInSeconds = rendering_stats_deltas.get( |
| 149 'totalInputLatency', 0) | 149 'totalInputLatency', 0) |
| 150 | 150 |
| 151 averageLatency = DivideIfPossibleOrZero( | 151 averageLatency = DivideIfPossibleOrZero( |
| 152 (totalInputLatencyInSeconds * 1000), inputEventCount) | 152 (totalInputLatencyInSeconds * 1000), inputEventCount) |
| 153 | 153 |
| 154 results.Add('average_latency', 'ms', averageLatency, | 154 results.Add('average_latency', 'ms', averageLatency, |
| 155 data_type='unimportant') | 155 data_type='unimportant') |
| 156 | 156 |
| 157 touchSystemCount = rendering_stats_deltas.get( | |
| 158 'touchSystemCount', 0) | |
| 159 totalTouchSystemLatencyInSeconds = rendering_stats_deltas.get( | |
| 160 'totalTouchSystemLatency', 0) | |
| 161 averageLatency = DivideIfPossibleOrZero( | |
| 162 (totalTouchSystemLatencyInSeconds * 1000), touchSystemCount) | |
| 163 results.Add('average_touch_system_latency', 'ms', averageLatency, | |
| 164 data_type='unimportant') | |
| 165 | |
| 166 touchUICount = rendering_stats_deltas.get( | |
| 167 'touchUICount', 0) | |
| 168 totalTouchUILatencyInSeconds = rendering_stats_deltas.get( | |
| 169 'totalTouchUILatency', 0) | |
| 170 averageLatency = DivideIfPossibleOrZero( | |
| 171 (totalTouchUILatencyInSeconds * 1000), touchUICount) | |
| 172 results.Add('average_touch_ui_latency', 'ms', averageLatency, | |
| 173 data_type='unimportant') | |
| 174 | |
| 175 touchAckedConsumedCount = rendering_stats_deltas.get( | |
| 176 'touchAckedConsumedCount', 0) | |
| 177 totalTouchAckedConsumedLatencyInSeconds = rendering_stats_deltas.get( | |
| 178 'totalTouchAckedConsumedLatency', 0) | |
| 179 averageLatency = DivideIfPossibleOrZero( | |
| 180 (totalTouchAckedConsumedLatencyInSeconds * 1000), touchAckedConsumedCount) | |
| 181 results.Add('average_touch_acked_consumed_latency', 'ms', averageLatency, | |
| 182 data_type='unimportant') | |
| 183 | |
| 184 touchAckedNotConsumedCount = rendering_stats_deltas.get( | |
| 185 'touchAckedNotConsumedCount', 0) | |
| 186 totalTouchAckedNotConsumedLatencyInSeconds = rendering_stats_deltas.get( | |
| 187 'totalTouchAckedNotConsumedLatency', 0) | |
| 188 averageLatency = DivideIfPossibleOrZero( | |
| 189 (totalTouchAckedNotConsumedLatencyInSeconds * 1000), | |
| 190 touchAckedNotConsumedCount) | |
| 191 results.Add('average_touch_acked_not_consumed_latency', 'ms', averageLatency, | |
| 192 data_type='unimportant') | |
| 193 | |
| 194 touchAckedNoConsumerCount = rendering_stats_deltas.get( | |
| 195 'touchAckedNoConsumerCount', 0) | |
| 196 totalTouchAckedNoConsumerLatencyInSeconds = rendering_stats_deltas.get( | |
| 197 'totalTouchAckedNoConsumerLatency', 0) | |
| 198 averageLatency = DivideIfPossibleOrZero( | |
| 199 (totalTouchAckedNoConsumerLatencyInSeconds * 1000), | |
| 200 touchAckedNoConsumerCount) | |
| 201 results.Add('average_touch_acked_no_consumer_latency', 'ms', averageLatency, | |
|
Rick Byers
2013/06/26 16:34:55
this is all pretty repetative, perhaps avoid dupli
Yufeng Shen (Slow to review)
2013/06/26 20:44:05
Done.
| |
| 202 data_type='unimportant') | |
| 157 | 203 |
| 158 class Smoothness(page_measurement.PageMeasurement): | 204 class Smoothness(page_measurement.PageMeasurement): |
| 159 def __init__(self): | 205 def __init__(self): |
| 160 super(Smoothness, self).__init__('smoothness') | 206 super(Smoothness, self).__init__('smoothness') |
| 161 self.force_enable_threaded_compositing = False | 207 self.force_enable_threaded_compositing = False |
| 162 self.use_gpu_benchmarking_extension = True | 208 self.use_gpu_benchmarking_extension = True |
| 163 self._metrics = None | 209 self._metrics = None |
| 164 | 210 |
| 165 def AddCommandLineOptions(self, parser): | 211 def AddCommandLineOptions(self, parser): |
| 166 parser.add_option('--report-all-results', dest='report_all_results', | 212 parser.add_option('--report-all-results', dest='report_all_results', |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 263 |
| 218 if self.options.report_all_results: | 264 if self.options.report_all_results: |
| 219 for k, v in rendering_stats_deltas.iteritems(): | 265 for k, v in rendering_stats_deltas.iteritems(): |
| 220 results.Add(k, '', v) | 266 results.Add(k, '', v) |
| 221 | 267 |
| 222 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 268 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 223 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 269 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
| 224 if not r.value: | 270 if not r.value: |
| 225 raise MissingDisplayFrameRate() | 271 raise MissingDisplayFrameRate() |
| 226 results.Add(r.name, r.unit, r.value) | 272 results.Add(r.name, r.unit, r.value) |
| OLD | NEW |