OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 from telemetry import multi_page_benchmark | |
6 | |
7 class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark): | |
8 @property | |
9 def results_are_the_same_on_every_page(self): | |
10 return False | |
11 | |
12 def WillNavigateToPage(self, page, tab): | |
13 tab.timeline.Start() | |
14 | |
15 def MeasurePage(self, page, tab, results): | |
16 # In current telemetry tests, all tests wait for DocumentComplete state. | |
17 # | |
18 # TODO(nduca): when crbug.com/168431 is fixed, modify the page sets to | |
19 # recognize loading as a toplevel action. | |
20 tab.timeline.Stop() | |
21 | |
22 events = tab.timeline.timeline_model.GetAllEvents() | |
23 | |
24 events_by_name = {} | |
25 for e in events: | |
26 if e.name not in events_by_name: | |
tonyg
2013/01/10 18:53:05
Use collections.defaultdict(list) to clean this up
| |
27 events_by_name[e.name] = [] | |
28 events_by_name[e.name].append(e) | |
29 | |
30 for key, group in events_by_name.items(): | |
31 times = [e.self_time_ms for e in group] | |
32 total = sum(times) | |
33 biggest_jank = max(times) | |
34 results.Add(key, 'ms', total) | |
35 results.Add(key + '_max', 'ms', biggest_jank) | |
36 results.Add(key + '_avg', 'ms', total / len(times)) | |
OLD | NEW |