blob: 7286cffd671974f96bef48a80c01d896a1aa761f [file] [log] [blame]
<!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/mappers/thread_grouping.html">
<link rel="import" href="/perf_insights/mappers/slice_cost.html">
<link rel="import" href="/perf_insights/function_handle.html">
<link rel="import" href="/perf_insights/value/value.html">
<link rel="import" href="/tracing/extras/rail/load_interaction_record.html">
<script>
tr.exportTo('pi.m', function() {
function startupMapFunction(results, runInfo, model) {
var startupIR;
model.interactionRecords.forEach(function(ir) {
if (ir instanceof tr.e.rail.LoadInteractionRecord &&
ir.name === 'Startup') {
startupIR = ir;
}
});
if (!startupIR)
return;
var threadGrouping = new pi.m.ThreadGrouping();
threadGrouping.autoInitUsingHelpers(model);
// TODO(beaudoin): Use the Startup IR associated events to filter out what
// should be included there, once the associated events work correctly.
var sliceCosts = pi.m.getSliceCostReport(model, threadGrouping, {},
function(event) {
return startupIR.bounds(event);
});
results.addValue(new pi.v.DictValue(runInfo, 'sr',
{sliceCosts: sliceCosts,
startupDuration: startupIR.duration}));
}
pi.FunctionRegistry.register(startupMapFunction);
// Exporting for tests.
return {
startupMapFunctionForTest: startupMapFunction
};
});
</script>