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

Unified Diff: perf_insights/perf_insights_examples/map_startup_info.html

Issue 1290323003: Create a mapper to compute browser and renderer startup durations. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 5 years, 4 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
Index: perf_insights/perf_insights_examples/map_startup_info.html
diff --git a/perf_insights/perf_insights_examples/map_startup_info.html b/perf_insights/perf_insights_examples/map_startup_info.html
new file mode 100644
index 0000000000000000000000000000000000000000..d4a3280f8bddce7ce29c91eb143559d2b899238a
--- /dev/null
+++ b/perf_insights/perf_insights_examples/map_startup_info.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<!--
+Copyright (c) 2015 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.
+-->
+<link rel="import" href="/perf_insights/value/value.html">
+<link rel="import" href="/perf_insights/map_function.html">
+
+<script>
+tr.exportTo('pie', function() {
+ function getProcessName(event) {
+ if (event && event.parentContainer && event.parentContainer.parent)
+ return event.parentContainer.parent.name;
+ }
dsinclair 2015/08/14 13:18:33 Can you add an explict return undefined; to the en
beaudoin 2015/08/14 20:28:54 Done.
+
+ function mapProcessCount(results, run_info, model) {
+ var startupIRs = model.interaction_records.filter(function(ir) {
+ return ir instanceof tr.e.rail.LoadInteractionRecord &&
+ ir.args['name'] && ir.args['name'] === 'Startup';
+ });
+ // Find the Startup IR in the browser process, there should only be 1.
+ var browser_begin;
dsinclair 2015/08/14 13:18:33 We usually use start instead of begin I believe.
beaudoin 2015/08/14 20:28:54 Done.
+ var browser_end;
+ var renderer_begin;
+ var renderer_end;
dsinclair 2015/08/14 13:18:33 Should these default to 0, then you don't need the
beaudoin 2015/08/14 20:28:54 Well, I can't really initialize them to 0 because
+ startupIRs.forEach(function(ir) {
+ ir.associatedEvents.toArray().forEach(function(event) {
+ var processName = getProcessName(event);
+ if (processName === 'Browser') {
dsinclair 2015/08/14 13:18:33 There is a tr.e.audits.ChromeBrowserHelper.isBrows
beaudoin 2015/08/14 20:28:54 Done. Do you know of another helper method to fin
+ browser_begin = Math.min(event.start, browser_begin || event.start);
+ var end = event.start + event.duration;
dsinclair 2015/08/14 13:18:33 This is the same for both if statements so can be
beaudoin 2015/08/14 20:28:54 Done.
+ browser_end = Math.max(end, browser_end || end);
+ }
+ if (processName === 'Renderer') {
+ renderer_begin = Math.min(event.start, renderer_begin || event.start);
+ var end = event.start + event.duration;
+ renderer_end = Math.max(end, renderer_end || end);
+ }
+ });
+ });
+
+ var startupInfo = {};
+ if (browser_begin !== undefined && browser_end !== undefined)
+ startupInfo['browserStartupDuration'] = browser_end - browser_begin;
+ if (renderer_begin !== undefined && renderer_end !== undefined)
+ startupInfo['rendererStartupDuration'] = renderer_end - renderer_begin;
+
+ results.addValue(new pi.v.DictValue(
+ run_info,
+ 'startup_info', startupInfo));
+ }
+
+ pi.MapFunction.register(mapProcessCount);
+
+ return {
+ mapProcessCount: mapProcessCount
dsinclair 2015/08/14 13:18:33 This is going to export mapProcessCount into the p
beaudoin 2015/08/14 20:28:54 Removed it and it still works. Nat: I notice you
+ };
+});
+</script>
« no previous file with comments | « no previous file | tracing/tracing/extras/rail/rail_ir_finder.html » ('j') | tracing/tracing/extras/rail/rail_ir_finder.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698