| Index: tracing/tracing/metrics/system_health/animation_throughput_metric.html
|
| diff --git a/tracing/tracing/metrics/system_health/animation_throughput_metric.html b/tracing/tracing/metrics/system_health/animation_throughput_metric.html
|
| index 13521d7b540c3ca634dd9a7cb113785c00c457fc..8cd74c64e3c42016eaecdac93ca3d0920383502c 100644
|
| --- a/tracing/tracing/metrics/system_health/animation_throughput_metric.html
|
| +++ b/tracing/tracing/metrics/system_health/animation_throughput_metric.html
|
| @@ -21,30 +21,40 @@ tr.exportTo('tr.metrics.sh', function() {
|
| // frames-per-second.
|
| var MIN_FPS = 10;
|
|
|
| - function AnimationThroughputMetric() {
|
| - }
|
| + var UNIT = tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
|
|
|
| - AnimationThroughputMetric.forModel = function(model, opt_rangeOfInterest) {
|
| - return tr.b.Statistics.weightedMean(
|
| - tr.metrics.sh.filterExpectationsByRange(
|
| - model.userModel.expectations, opt_rangeOfInterest),
|
| - tr.metrics.sh.perceptualBlend,
|
| - AnimationThroughputMetric.forExpectation);
|
| - };
|
| + var DESCRIPTION = 'Mean Opinion Score for Animation throughput';
|
|
|
| - AnimationThroughputMetric.forExpectation = function(ir) {
|
| - if (!(ir instanceof tr.model.um.AnimationExpectation))
|
| - return undefined;
|
| + function AnimationThroughputMetric(valueList, model) {
|
| + model.userModel.expectations.forEach(function(ue) {
|
| + if (!(ue instanceof tr.model.um.AnimationExpectation))
|
| + return;
|
|
|
| - if (ir.frameEvents === undefined ||
|
| - ir.frameEvents.length === 0)
|
| - return undefined;
|
| + if (ue.frameEvents === undefined ||
|
| + ue.frameEvents.length === 0)
|
| + throw new Error('Animation missing frameEvents ' + ue.stableId);
|
|
|
| - var durationSeconds = ir.duration / 1000;
|
| - var avgSpf = durationSeconds / ir.frameEvents.length;
|
| - var throughput = 1 - tr.b.normalize(avgSpf, 1 / MAX_FPS, 1 / MIN_FPS);
|
| - return tr.b.clamp(throughput, 0, 1);
|
| - };
|
| + var options = {};
|
| + options.description = DESCRIPTION;
|
| +
|
| + var groupingKeys = {};
|
| + groupingKeys.userExpectation = ue.stableId;
|
| + groupingKeys.userExpectationStageTitle = ue.stageTitle;
|
| + groupingKeys.userExpectationInitiatorTitle = ue.initiatorTitle;
|
| +
|
| + var durationSeconds = ue.duration / 1000;
|
| + var avgSpf = durationSeconds / ue.frameEvents.length;
|
| + var throughput = 1 - tr.b.normalize(avgSpf, 1 / MAX_FPS, 1 / MIN_FPS);
|
| + var score = tr.b.clamp(throughput, 0, 1);
|
| +
|
| + valueList.addValue(new tr.v.NumericValue(
|
| + model.canonicalUrlThatCreatedThisTrace, 'throughput',
|
| + new tr.v.ScalarNumeric(UNIT, score),
|
| + options, groupingKeys));
|
| + });
|
| + }
|
| +
|
| + tr.metrics.MetricRegistry.register(AnimationThroughputMetric);
|
|
|
| return {
|
| AnimationThroughputMetric: AnimationThroughputMetric
|
|
|