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 <link rel="import" href="/tracing/extras/chrome/chrome_renderer_helper.html"> |
| 12 |
| 13 <script> |
| 14 tr.exportTo('pie', function() { |
| 15 function mapStartupInfo(results, run_info, model) { |
| 16 var startupIRs = model.interaction_records.filter(function(ir) { |
| 17 return ir instanceof tr.e.rail.LoadInteractionRecord && |
| 18 ir.name === 'Startup'; |
| 19 }); |
| 20 // Find the Startup IRs in the browser and renderer processes. |
| 21 var ChromeBrowserHelper = tr.e.audits.ChromeBrowserHelper; |
| 22 var ChromeRendererHelper = tr.e.audits.ChromeRendererHelper; |
| 23 var browser_startup = new tr.b.Range(); |
| 24 var renderer_startup = new tr.b.Range(); |
| 25 startupIRs.forEach(function(ir) { |
| 26 ir.associatedEvents.toArray().forEach(function(event) { |
| 27 if (!event.getProcess) |
| 28 return; |
| 29 var process = event.getProcess(); |
| 30 var end = event.start + event.duration; |
| 31 if (ChromeBrowserHelper.isBrowserProcess(process)) |
| 32 event.addBoundsToRange(browser_startup); |
| 33 if (ChromeRendererHelper.isRenderProcess(process)) |
| 34 event.addBoundsToRange(renderer_startup); |
| 35 }); |
| 36 }); |
| 37 |
| 38 if (browser_startup.isEmpty && renderer_startup.isEmpty) { |
| 39 results.addValue(new pi.v.SkipValue(run_info, 'startup_info')); |
| 40 } else { |
| 41 results.addValue(new pi.v.DictValue( |
| 42 run_info, |
| 43 'startup_info', |
| 44 { |
| 45 'browserStartup': browser_startup, |
| 46 'rendererStartup': renderer_startup |
| 47 })); |
| 48 } |
| 49 } |
| 50 |
| 51 pi.MapFunction.register(mapStartupInfo); |
| 52 |
| 53 // Exporting for tests. |
| 54 return { |
| 55 mapStartupInfo: mapStartupInfo |
| 56 }; |
| 57 }); |
| 58 </script> |
OLD | NEW |