summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html158
1 files changed, 0 insertions, 158 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
deleted file mode 100644
index 5098c535277..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!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="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/load_expectation.html">
-<link rel="import" href="/tracing/model/user_model/response_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- // In the case of Response, Load, and DiscreteAnimation IRs, Responsiveness is
- // derived from the time between when the user thinks they begin an interation
- // (expectedStart) and the time when the screen first changes to reflect the
- // interaction (actualEnd). There may be a delay between expectedStart and
- // when chrome first starts processing the interaction (actualStart) if the
- // main thread is busy. The user doesn't know when actualStart is, they only
- // know when expectedStart is. User responsiveness, by definition, considers
- // only what the user experiences, so "duration" is defined as actualEnd -
- // expectedStart.
-
- function computeAnimationThroughput(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var durationSeconds = animationExpectation.duration / 1000;
- return animationExpectation.frameEvents.length / durationSeconds;
- }
-
- function computeAnimationframeTimeDiscrepancy(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var frameTimestamps = animationExpectation.frameEvents;
- frameTimestamps = frameTimestamps.toArray().map(function(event) {
- return event.start;
- });
-
- var absolute = false;
- return tr.b.Statistics.timestampsDiscrepancy(frameTimestamps, absolute);
- }
-
- var RESPONSE_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(100, 1000), 90);
-
- var THROUGHPUT_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_biggerIsBetter,
- tr.b.Range.fromExplicitRange(10, 60), 10);
-
- var DISCREPANCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 1), 50);
-
- var LATENCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 300), 60);
-
- /**
- * @param {!tr.v.ValueSet} values
- * @param {!tr.model.Model} model
- * @param {!Object=} opt_options
- */
- function responsivenessMetric(values, model, opt_options) {
- // TODO(benjhayden): Add categories to benchmark to support:
- // tr.metrics.sh.firstPaintMetric(values, model);
-
- var responseNumeric = RESPONSE_NUMERIC_BUILDER.build();
- var throughputNumeric = THROUGHPUT_NUMERIC_BUILDER.build();
- var frameTimeDiscrepancyNumeric = DISCREPANCY_NUMERIC_BUILDER.build();
- var latencyNumeric = LATENCY_NUMERIC_BUILDER.build();
-
- model.userModel.expectations.forEach(function(ue) {
- if (opt_options && opt_options.rangeOfInterest &&
- !opt_options.rangeOfInterest.intersectsExplicitRangeExclusive(
- ue.start, ue.end))
- return;
-
- var sourceInfo = {userExpectationId: ue.stableId};
-
- // Responsiveness is not defined for Idle.
- if (ue instanceof tr.model.um.IdleExpectation) {
- return;
- } else if (ue instanceof tr.model.um.LoadExpectation) {
- // This is already covered by firstPaintMetric.
- } else if (ue instanceof tr.model.um.ResponseExpectation) {
- responseNumeric.add(ue.duration, sourceInfo);
- } else if (ue instanceof tr.model.um.AnimationExpectation) {
- var throughput = computeAnimationThroughput(ue);
- if (throughput === undefined)
- throw new Error('Missing throughput for ' +
- ue.stableId);
-
- throughputNumeric.add(throughput, sourceInfo);
-
- var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue);
- if (frameTimeDiscrepancy === undefined)
- throw new Error('Missing frameTimeDiscrepancy for ' +
- ue.stableId);
-
- frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, sourceInfo);
-
- ue.associatedEvents.forEach(function(event) {
- if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice))
- return;
-
- latencyNumeric.add(event.duration, sourceInfo);
- });
- } else {
- throw new Error('Unrecognized stage for ' + ue.stableId);
- }
- });
-
- [
- responseNumeric, throughputNumeric, frameTimeDiscrepancyNumeric,
- latencyNumeric
- ].forEach(function(numeric) {
- numeric.customizeSummaryOptions({
- avg: true,
- max: true,
- min: true,
- std: true
- });
- });
-
- values.addValue(new tr.v.NumericValue(
- 'response latency', responseNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation throughput', throughputNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation frameTimeDiscrepancy',
- frameTimeDiscrepancyNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation latency', latencyNumeric));
- }
-
- tr.metrics.MetricRegistry.register(responsivenessMetric, {
- supportsRangeOfInterest: true
- });
-
- return {
- responsivenessMetric: responsivenessMetric,
- };
-});
-</script>