| 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 collections | 5 import collections |
| 6 | 6 |
| 7 from telemetry.core import util | 7 from telemetry import multi_page_benchmark |
| 8 from telemetry.page import multi_page_benchmark | 8 from telemetry import util |
| 9 | 9 |
| 10 class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark): | 10 class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark): |
| 11 @property | 11 @property |
| 12 def results_are_the_same_on_every_page(self): | 12 def results_are_the_same_on_every_page(self): |
| 13 return False | 13 return False |
| 14 | 14 |
| 15 def WillNavigateToPage(self, page, tab): | 15 def WillNavigateToPage(self, page, tab): |
| 16 tab.StartTimelineRecording() | 16 tab.StartTimelineRecording() |
| 17 | 17 |
| 18 def MeasurePage(self, page, tab, results): | 18 def MeasurePage(self, page, tab, results): |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 for e in events: | 43 for e in events: |
| 44 events_by_name[e.name].append(e) | 44 events_by_name[e.name].append(e) |
| 45 | 45 |
| 46 for key, group in events_by_name.items(): | 46 for key, group in events_by_name.items(): |
| 47 times = [e.self_time_ms for e in group] | 47 times = [e.self_time_ms for e in group] |
| 48 total = sum(times) | 48 total = sum(times) |
| 49 biggest_jank = max(times) | 49 biggest_jank = max(times) |
| 50 results.Add(key, 'ms', total) | 50 results.Add(key, 'ms', total) |
| 51 results.Add(key + '_max', 'ms', biggest_jank) | 51 results.Add(key + '_max', 'ms', biggest_jank) |
| 52 results.Add(key + '_avg', 'ms', total / len(times)) | 52 results.Add(key + '_avg', 'ms', total / len(times)) |
| OLD | NEW |