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 telemetry import multi_page_benchmark | 4 from telemetry import multi_page_benchmark |
5 from telemetry import util | 5 from telemetry import util |
6 | 6 |
7 class DidNotScrollException(multi_page_benchmark.MeasurementFailure): | 7 class DidNotScrollException(multi_page_benchmark.MeasurementFailure): |
8 def __init__(self): | 8 def __init__(self): |
9 super(DidNotScrollException, self).__init__('Page did not scroll') | 9 super(DidNotScrollException, self).__init__('Page did not scroll') |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 }); | 105 }); |
106 """) | 106 """) |
107 util.WaitFor(lambda: tab.runtime.Evaluate('window.__rafFired'), 60) | 107 util.WaitFor(lambda: tab.runtime.Evaluate('window.__rafFired'), 60) |
108 | 108 |
109 first_paint_secs = tab.runtime.Evaluate( | 109 first_paint_secs = tab.runtime.Evaluate( |
110 'window.chrome.loadTimes().firstPaintTime - ' + | 110 'window.chrome.loadTimes().firstPaintTime - ' + |
111 'window.chrome.loadTimes().startLoadTime') | 111 'window.chrome.loadTimes().startLoadTime') |
112 | 112 |
113 results.Add('first_paint', 'ms', round(first_paint_secs * 1000, 1)) | 113 results.Add('first_paint', 'ms', round(first_paint_secs * 1000, 1)) |
114 | 114 |
| 115 def CalcImageDecodingResults(rendering_stats_deltas, results): |
| 116 totalDeferredImageDecodeCount = rendering_stats_deltas.get( |
| 117 'totalDeferredImageDecodeCount', 0) |
| 118 totalDeferredImageCacheHitCount = rendering_stats_deltas.get( |
| 119 'totalDeferredImageCacheHitCount', 0) |
| 120 totalImageGatheringCount = rendering_stats_deltas.get( |
| 121 'totalImageGatheringCount', 0) |
| 122 totalDeferredImageDecodeTimeInSeconds = rendering_stats_deltas.get( |
| 123 'totalDeferredImageDecodeTimeInSeconds', 0) |
| 124 totalImageGatheringTimeInSeconds = rendering_stats_deltas.get( |
| 125 'totalImageGatheringTimeInSeconds', 0) |
| 126 |
| 127 averageImageGatheringTime = DivideIfPossibleOrZero( |
| 128 (totalImageGatheringTimeInSeconds * 1000), totalImageGatheringCount) |
| 129 |
| 130 results.Add('total_deferred_image_decode_count', 'count', |
| 131 totalDeferredImageDecodeCount, |
| 132 data_type='unimportant') |
| 133 results.Add('total_image_cache_hit_count', 'count', |
| 134 totalDeferredImageCacheHitCount, |
| 135 data_type='unimportant') |
| 136 results.Add('average_image_gathering_time', 'ms', averageImageGatheringTime, |
| 137 data_type='unimportant') |
| 138 results.Add('total_deferred_image_decoding_time', 'seconds', |
| 139 totalDeferredImageDecodeTimeInSeconds, |
| 140 data_type='unimportant') |
| 141 |
115 class SmoothnessBenchmark(multi_page_benchmark.MultiPageBenchmark): | 142 class SmoothnessBenchmark(multi_page_benchmark.MultiPageBenchmark): |
116 def __init__(self): | 143 def __init__(self): |
117 super(SmoothnessBenchmark, self).__init__('scrolling') | 144 super(SmoothnessBenchmark, self).__init__('scrolling') |
118 self.force_enable_threaded_compositing = False | 145 self.force_enable_threaded_compositing = False |
119 self.use_gpu_benchmarking_extension = True | 146 self.use_gpu_benchmarking_extension = True |
120 | 147 |
121 def AddCommandLineOptions(self, parser): | 148 def AddCommandLineOptions(self, parser): |
122 parser.add_option('--report-all-results', dest='report_all_results', | 149 parser.add_option('--report-all-results', dest='report_all_results', |
123 action='store_true', | 150 action='store_true', |
124 help='Reports all data collected, not just FPS') | 151 help='Reports all data collected, not just FPS') |
(...skipping 11 matching lines...) Expand all Loading... |
136 rendering_stats_deltas = tab.runtime.Evaluate( | 163 rendering_stats_deltas = tab.runtime.Evaluate( |
137 'window.__renderingStatsDeltas') | 164 'window.__renderingStatsDeltas') |
138 | 165 |
139 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): | 166 if not (rendering_stats_deltas['numFramesSentToScreen'] > 0): |
140 raise DidNotScrollException() | 167 raise DidNotScrollException() |
141 | 168 |
142 CalcFirstPaintTimeResults(results, tab) | 169 CalcFirstPaintTimeResults(results, tab) |
143 CalcScrollResults(rendering_stats_deltas, results) | 170 CalcScrollResults(rendering_stats_deltas, results) |
144 CalcPaintingResults(rendering_stats_deltas, results) | 171 CalcPaintingResults(rendering_stats_deltas, results) |
145 CalcTextureUploadResults(rendering_stats_deltas, results) | 172 CalcTextureUploadResults(rendering_stats_deltas, results) |
| 173 CalcImageDecodingResults(rendering_stats_deltas, results) |
146 | 174 |
147 if self.options.report_all_results: | 175 if self.options.report_all_results: |
148 for k, v in rendering_stats_deltas.iteritems(): | 176 for k, v in rendering_stats_deltas.iteritems(): |
149 results.Add(k, '', v) | 177 results.Add(k, '', v) |
OLD | NEW |