Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: tools/perf/perf_tools/loading_benchmark.py

Issue 11791043: Benchmark to characterize main thread usage during load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: this_could_land Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/perf/perf_tools/loading_benchmark_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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))
OLDNEW
« no previous file with comments | « no previous file | tools/perf/perf_tools/loading_benchmark_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698