Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: tracing/tracing/metrics/system_health/animation_throughput_metric.html

Issue 1730313007: Metric-ify SystemHealth metrics (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698