| 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 | 4 |
| 5 from telemetry import multi_page_benchmark | 5 from telemetry import multi_page_benchmark |
| 6 from telemetry import util | 6 from telemetry import util |
| 7 | 7 |
| 8 class DidNotScrollException(multi_page_benchmark.MeasurementFailure): | 8 class DidNotScrollException(multi_page_benchmark.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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 totalDeferredImageCacheHitCount, | 137 totalDeferredImageCacheHitCount, |
| 138 data_type='unimportant') | 138 data_type='unimportant') |
| 139 results.Add('average_image_gathering_time', 'ms', averageImageGatheringTime, | 139 results.Add('average_image_gathering_time', 'ms', averageImageGatheringTime, |
| 140 data_type='unimportant') | 140 data_type='unimportant') |
| 141 results.Add('total_deferred_image_decoding_time', 'seconds', | 141 results.Add('total_deferred_image_decoding_time', 'seconds', |
| 142 totalDeferredImageDecodeTimeInSeconds, | 142 totalDeferredImageDecodeTimeInSeconds, |
| 143 data_type='unimportant') | 143 data_type='unimportant') |
| 144 | 144 |
| 145 class SmoothnessBenchmark(multi_page_benchmark.MultiPageBenchmark): | 145 class SmoothnessBenchmark(multi_page_benchmark.MultiPageBenchmark): |
| 146 def __init__(self): | 146 def __init__(self): |
| 147 super(SmoothnessBenchmark, self).__init__('scrolling') | 147 super(SmoothnessBenchmark, self).__init__('smoothness') |
| 148 self.force_enable_threaded_compositing = False | 148 self.force_enable_threaded_compositing = False |
| 149 self.use_gpu_benchmarking_extension = True | 149 self.use_gpu_benchmarking_extension = True |
| 150 | 150 |
| 151 def AddCommandLineOptions(self, parser): | 151 def AddCommandLineOptions(self, parser): |
| 152 parser.add_option('--report-all-results', dest='report_all_results', | 152 parser.add_option('--report-all-results', dest='report_all_results', |
| 153 action='store_true', | 153 action='store_true', |
| 154 help='Reports all data collected, not just FPS') | 154 help='Reports all data collected, not just FPS') |
| 155 | 155 |
| 156 def CustomizeBrowserOptions(self, options): | 156 def CustomizeBrowserOptions(self, options): |
| 157 if self.use_gpu_benchmarking_extension: | 157 if self.use_gpu_benchmarking_extension: |
| 158 options.extra_browser_args.append('--enable-gpu-benchmarking') | 158 options.extra_browser_args.append('--enable-gpu-benchmarking') |
| 159 if self.force_enable_threaded_compositing: | 159 if self.force_enable_threaded_compositing: |
| 160 options.extra_browser_args.append('--enable-threaded-compositing') | 160 options.extra_browser_args.append('--enable-threaded-compositing') |
| 161 | 161 |
| 162 def CanRunForPage(self, page): | 162 def CanRunForPage(self, page): |
| 163 return hasattr(page, 'scrolling') | 163 return hasattr(page, 'smoothness') |
| 164 | 164 |
| 165 def MeasurePage(self, page, tab, results): | 165 def MeasurePage(self, page, tab, results): |
| 166 rendering_stats_deltas = tab.runtime.Evaluate( | 166 rendering_stats_deltas = tab.runtime.Evaluate( |
| 167 'window.__renderingStatsDeltas') | 167 'window.__renderingStatsDeltas') |
| 168 | 168 |
| 169 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): | 169 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): |
| 170 raise DidNotScrollException() | 170 raise DidNotScrollException() |
| 171 | 171 |
| 172 CalcFirstPaintTimeResults(results, tab) | 172 CalcFirstPaintTimeResults(results, tab) |
| 173 CalcScrollResults(rendering_stats_deltas, results) | 173 CalcScrollResults(rendering_stats_deltas, results) |
| 174 CalcPaintingResults(rendering_stats_deltas, results) | 174 CalcPaintingResults(rendering_stats_deltas, results) |
| 175 CalcTextureUploadResults(rendering_stats_deltas, results) | 175 CalcTextureUploadResults(rendering_stats_deltas, results) |
| 176 CalcImageDecodingResults(rendering_stats_deltas, results) | 176 CalcImageDecodingResults(rendering_stats_deltas, results) |
| 177 | 177 |
| 178 if self.options.report_all_results: | 178 if self.options.report_all_results: |
| 179 for k, v in rendering_stats_deltas.iteritems(): | 179 for k, v in rendering_stats_deltas.iteritems(): |
| 180 results.Add(k, '', v) | 180 results.Add(k, '', v) |
| OLD | NEW |