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

Unified 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: nitfix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/perf/perf_tools/loading_benchmark_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/perf_tools/loading_benchmark.py
diff --git a/tools/perf/perf_tools/loading_benchmark.py b/tools/perf/perf_tools/loading_benchmark.py
new file mode 100644
index 0000000000000000000000000000000000000000..61b6a0161c1a9cc8bed678c0c6f0e113ffed9420
--- /dev/null
+++ b/tools/perf/perf_tools/loading_benchmark.py
@@ -0,0 +1,36 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import collections
+
+from telemetry import multi_page_benchmark
+
+class LoadingBenchmark(multi_page_benchmark.MultiPageBenchmark):
+ @property
+ def results_are_the_same_on_every_page(self):
+ return False
+
+ def WillNavigateToPage(self, page, tab):
+ tab.timeline.Start()
+
+ def MeasurePage(self, page, tab, results):
+ # In current telemetry tests, all tests wait for DocumentComplete state.
+ #
+ # TODO(nduca): when crbug.com/168431 is fixed, modify the page sets to
+ # recognize loading as a toplevel action.
+ tab.timeline.Stop()
+
+ events = tab.timeline.timeline_model.GetAllEvents()
+
+ events_by_name = collections.defaultdict(list)
+ for e in events:
+ events_by_name[e.name].append(e)
+
+ for key, group in events_by_name.items():
+ times = [e.self_time_ms for e in group]
+ total = sum(times)
+ biggest_jank = max(times)
+ results.Add(key, 'ms', total)
+ results.Add(key + '_max', 'ms', biggest_jank)
+ results.Add(key + '_avg', 'ms', total / len(times))
« 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