Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <!-- | |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 4 Use of this source code is governed by a BSD-style license that can be | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 <link rel="import" href="/perf_insights/value/value.html"> | |
| 8 <link rel="import" href="/perf_insights/map_function.html"> | |
| 9 <link rel="import" href="/tracing/base/range.html"> | |
| 10 <link rel="import" href="/tracing/extras/chrome/chrome_browser_helper.html"> | |
| 11 | |
| 12 <script> | |
| 13 tr.exportTo('pie', function() { | |
| 14 function mapStartupInfo(results, run_info, model) { | |
| 15 var startupIRs = model.interaction_records.filter(function(ir) { | |
| 16 return ir instanceof tr.e.rail.LoadInteractionRecord && | |
| 17 ir.name === 'Startup'; | |
| 18 }); | |
| 19 // Find the Startup IRs in the browser and renderer processes. | |
| 20 var helper = tr.e.audits.ChromeBrowserHelper; | |
| 21 var browser_startup = new tr.b.Range(); | |
| 22 var renderer_startup = new tr.b.Range(); | |
| 23 startupIRs.forEach(function(ir) { | |
| 24 ir.associatedEvents.toArray().forEach(function(event) { | |
| 25 if (!event.getProcess) | |
| 26 return; | |
| 27 var process = event.getProcess(); | |
| 28 var end = event.start + event.duration; | |
| 29 if (helper.isBrowserProcess(process)) | |
|
nduca
2015/08/14 22:28:49
nit: this looks like you're referring to an on an
beaudoin
2015/08/18 16:16:54
Done.
| |
| 30 event.addBoundsToRange(browser_startup); | |
| 31 if (helper.isRendererProcess(process)) | |
| 32 event.addBoundsToRange(renderer_startup); | |
| 33 }); | |
| 34 }); | |
| 35 | |
| 36 var startup_info = {}; | |
| 37 if (!browser_startup.isEmpty) | |
|
nduca
2015/08/14 22:28:49
i think it would be easier on the data processing
beaudoin
2015/08/18 16:16:54
Done.
| |
| 38 startup_info['browserStartupDuration'] = browser_startup.range; | |
| 39 if (!renderer_startup.isEmpty) | |
| 40 startup_info['rendererStartupDuration'] = renderer_startup.range; | |
| 41 | |
| 42 if (Object.keys(startup_info).length === 0) { | |
| 43 results.addValue(new pi.v.SkipValue(run_info)); | |
|
nduca
2015/08/14 22:28:49
you'll wanna say what result name was skipped, e.g
beaudoin
2015/08/18 16:16:54
Done.
| |
| 44 } else { | |
| 45 results.addValue(new pi.v.DictValue( | |
| 46 run_info, | |
| 47 'startup_info', | |
| 48 startup_info)); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 pi.MapFunction.register(mapStartupInfo); | |
| 53 | |
| 54 // Exporting for tests. | |
| 55 return { | |
| 56 mapStartupInfo: mapStartupInfo | |
| 57 }; | |
| 58 }); | |
| 59 </script> | |
| OLD | NEW |