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 import time | 5 import time |
6 | 6 |
7 from metrics import smoothness | 7 from metrics import smoothness |
8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
| 9 from telemetry.page import result_data_type |
9 | 10 |
10 class StatsCollector(object): | 11 class StatsCollector(object): |
11 def __init__(self, timeline): | 12 def __init__(self, timeline): |
12 """ | 13 """ |
13 Utility class for collecting rendering stats from timeline model. | 14 Utility class for collecting rendering stats from timeline model. |
14 | 15 |
15 timeline -- The timeline model | 16 timeline -- The timeline model |
16 """ | 17 """ |
17 self.timeline = timeline | 18 self.timeline = timeline |
18 self.total_best_rasterize_time = 0 | 19 self.total_best_rasterize_time = 0 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 self._metrics.Stop() | 170 self._metrics.Stop() |
170 | 171 |
171 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() | 172 timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() |
172 collector = StatsCollector(timeline) | 173 collector = StatsCollector(timeline) |
173 collector.GatherRenderingStats() | 174 collector.GatherRenderingStats() |
174 | 175 |
175 rendering_stats = self._metrics.end_values | 176 rendering_stats = self._metrics.end_values |
176 | 177 |
177 results.Add('best_rasterize_time', 'seconds', | 178 results.Add('best_rasterize_time', 'seconds', |
178 collector.total_best_rasterize_time / 1.e3, | 179 collector.total_best_rasterize_time / 1.e3, |
179 data_type='unimportant') | 180 data_type=result_data_type.UNIMPORTANT) |
180 results.Add('best_record_time', 'seconds', | 181 results.Add('best_record_time', 'seconds', |
181 collector.total_best_record_time / 1.e3, | 182 collector.total_best_record_time / 1.e3, |
182 data_type='unimportant') | 183 data_type=result_data_type.UNIMPORTANT) |
183 results.Add('total_pixels_rasterized', 'pixels', | 184 results.Add('total_pixels_rasterized', 'pixels', |
184 collector.total_pixels_rasterized, | 185 collector.total_pixels_rasterized, |
185 data_type='unimportant') | 186 data_type=result_data_type.UNIMPORTANT) |
186 results.Add('total_pixels_recorded', 'pixels', | 187 results.Add('total_pixels_recorded', 'pixels', |
187 collector.total_pixels_recorded, | 188 collector.total_pixels_recorded, |
188 data_type='unimportant') | 189 data_type=result_data_type.UNIMPORTANT) |
189 | 190 |
190 if self.options.report_all_results: | 191 if self.options.report_all_results: |
191 for k, v in rendering_stats.iteritems(): | 192 for k, v in rendering_stats.iteritems(): |
192 results.Add(k, '', v) | 193 results.Add(k, '', v) |
OLD | NEW |