| Index: tracing/tracing/metrics/system_health/animation_smoothness_metric.html
|
| diff --git a/tracing/tracing/metrics/system_health/animation_smoothness_metric.html b/tracing/tracing/metrics/system_health/animation_smoothness_metric.html
|
| index f2d4e0d6d757fde5a7ad44aabbf9f11d1b942c94..afaddcda7c88d60bea21a29a66df9ba2098e8f48 100644
|
| --- a/tracing/tracing/metrics/system_health/animation_smoothness_metric.html
|
| +++ b/tracing/tracing/metrics/system_health/animation_smoothness_metric.html
|
| @@ -4,9 +4,10 @@ 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/model/user_model/animation_expectation.html">
|
| <link rel="import" href="/tracing/metrics/system_health/utils.html">
|
| +<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
|
|
|
| <script>
|
| 'use strict';
|
| @@ -20,35 +21,46 @@ tr.exportTo('tr.metrics.sh', function() {
|
| // greater than or equal to this:
|
| var MAX_DISCREPANCY = 0.3;
|
|
|
| - function AnimationSmoothnessMetric() {
|
| - }
|
| + var UNIT = tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
|
|
|
| - AnimationSmoothnessMetric.forModel = function(model, opt_rangeOfInterest) {
|
| - return tr.b.Statistics.weightedMean(
|
| - tr.metrics.sh.filterExpectationsByRange(
|
| - model.userModel.expectations, opt_rangeOfInterest),
|
| - tr.metrics.sh.perceptualBlend,
|
| - AnimationSmoothnessMetric.forExpectation);
|
| - };
|
| + var DESCRIPTION = 'Mean Opinion Score for Animation smoothness';
|
|
|
| - AnimationSmoothnessMetric.forExpectation = function(ir) {
|
| - if (!(ir instanceof tr.model.um.AnimationExpectation))
|
| - return undefined;
|
| + function AnimationSmoothnessMetric(valueList, model) {
|
| + model.userModel.expectations.forEach(function(ue) {
|
| + if (!(ue instanceof tr.model.um.AnimationExpectation))
|
| + return;
|
|
|
| - var frameTimestamps = ir.frameEvents.toArray().map(function(event) {
|
| - return event.start;
|
| - });
|
| + if (ue.frameEvents === undefined ||
|
| + ue.frameEvents.length === 0)
|
| + throw new Error('Animation missing frameEvents ' + ue.stableId);
|
|
|
| - if (frameTimestamps.length === 0)
|
| - return undefined;
|
| + var options = {};
|
| + options.description = DESCRIPTION;
|
|
|
| - var absolute = false;
|
| - var discrepancy = tr.b.Statistics.timestampsDiscrepancy(
|
| - frameTimestamps, absolute);
|
| - var smoothness = 1 - tr.b.normalize(
|
| - discrepancy, MIN_DISCREPANCY, MAX_DISCREPANCY);
|
| - return tr.b.clamp(smoothness, 0, 1);
|
| - };
|
| + var groupingKeys = {};
|
| + groupingKeys.userExpectation = ue.stableId;
|
| + groupingKeys.userExpectationStageTitle = ue.stageTitle;
|
| + groupingKeys.userExpectationInitiatorTitle = ue.initiatorTitle;
|
| +
|
| + var frameTimestamps = ue.frameEvents.toArray().map(function(event) {
|
| + return event.start;
|
| + });
|
| +
|
| + var absolute = false;
|
| + var discrepancy = tr.b.Statistics.timestampsDiscrepancy(
|
| + frameTimestamps, absolute);
|
| + var smoothness = 1 - tr.b.normalize(
|
| + discrepancy, MIN_DISCREPANCY, MAX_DISCREPANCY);
|
| + var score = tr.b.clamp(smoothness, 0, 1);
|
| +
|
| + valueList.addValue(new tr.v.NumericValue(
|
| + model.canonicalUrlThatCreatedThisTrace, 'smoothness',
|
| + new tr.v.ScalarNumeric(UNIT, score),
|
| + options, groupingKeys));
|
| + });
|
| + }
|
| +
|
| + tr.metrics.MetricRegistry.register(AnimationSmoothnessMetric);
|
|
|
| return {
|
| AnimationSmoothnessMetric: AnimationSmoothnessMetric
|
|
|