blob: 2a2f65d2c5f003ad4cf9d2292c5e40f3e3e941cd [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="/base/base.html">
<link rel="import" href="/base/statistics.html">
<link rel="import" href="/base/xhr.html">
<link rel="import" href="/base/iteration_helpers.html">
<link rel="import" href="/extras/deep_reports/scalar_value.html">
<link rel="import" href="/extras/rail/rail_interaction_record.html">
<link rel="import" href="/extras/rail/rail_score.html">
<script>
'use strict';
tr.exportTo('tr.e.deep_reports', function() {
function RAILDeepReporter() {
};
RAILDeepReporter.addResultsForModel = function(results, page, model) {
var rirs = [];
model.interaction_records.forEach(function(ir) {
if (ir instanceof tr.e.rail.RAILInteractionRecord)
rirs.push(ir);
});
if (rirs.length === 0)
return;
var railScore = tr.e.rail.RAILScore.compute(rirs);
results.addValue(
new tr.e.deep_reports.ScalarValue(
page, 'numRailIRs', 'ms', rirs.length));
tr.b.iterItems(railScore, function(key, value) {
if (key === 'score')
return;
results.addValue(
new tr.e.deep_reports.ScalarValue(
page, key, 'rails', value));
});
results.addValue(
new tr.e.deep_reports.ScalarValue(
page, 'railScore', 'rails', railScore.score));
}
return {
RAILDeepReporter: RAILDeepReporter
};
});
</script>