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

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: Rebased. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
nduca 2015/08/14 20:29:31 driveby thought, nonblocking: should we be making
beaudoin 2015/08/14 22:10:41 Did something. It's a bit far reaching but I think
+ if (event && event.parentContainer && event.parentContainer.parent)
+ return event.parentContainer.parent.name;
+ }
+
+ function mapProcessCount(results, run_info, model) {
+ var startupIRs = model.interaction_records.filter(function(ir) {
+ return ir instanceof tr.e.rail.LoadInteractionRecord &&
nduca 2015/08/14 20:29:31 can you have the title of the LoadInteractionRecor
beaudoin 2015/08/14 22:10:41 I now have a 'name' field on the all IRs. This was
+ ir.args['name'] && ir.args['name'] === 'Startup';
+ });
+ // Find the Startup IR in the browser process, there should only be 1.
+ var browser_begin;
+ var browser_end;
+ var renderer_begin;
+ var renderer_end;
+ startupIRs.forEach(function(ir) {
+ ir.associatedEvents.toArray().forEach(function(event) {
+ var processName = getProcessName(event);
nduca 2015/08/14 20:29:31 can you somehow use chrome model helper here? e.g
beaudoin 2015/08/14 22:10:41 Done.
+ if (processName === 'Browser') {
+ browser_begin = Math.min(event.start, browser_begin || event.start);
nduca 2015/08/14 20:29:32 can you use tr.b.Range for this?
beaudoin 2015/08/14 22:10:41 OMG! I SEE THE LIGHT! Done.
+ var end = event.start + event.duration;
+ 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)
nduca 2015/08/14 20:29:31 if you used ranges, you'd say if (range.isEmpty) r
beaudoin 2015/08/14 22:10:41 Problem went away...
+ 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
nduca 2015/08/14 20:29:32 name the function differently plox?
beaudoin 2015/08/14 22:10:41 Done.
+ };
+});
+</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698