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

Side by Side Diff: tracing/tracing/extras/rail/animation_interaction_record.html

Issue 1357983002: Invert pain to comfort throughout tracing. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: . Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | tracing/tracing/extras/rail/animation_interaction_record_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. 3 Copyright (c) 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/statistics.html"> 8 <link rel="import" href="/tracing/base/statistics.html">
9 <link rel="import" href="/tracing/extras/chrome/chrome_process_helper.html"> 9 <link rel="import" href="/tracing/extras/chrome/chrome_process_helper.html">
10 <link rel="import" href="/tracing/extras/rail/rail_interaction_record.html"> 10 <link rel="import" href="/tracing/extras/rail/rail_interaction_record.html">
11 11
12 <script> 12 <script>
13 'use strict'; 13 'use strict';
14 14
15 /** 15 /**
16 * @fileoverview The Animation phase of RAIL. 16 * @fileoverview The Animation phase of RAIL.
17 */ 17 */
18 tr.exportTo('tr.e.rail', function() { 18 tr.exportTo('tr.e.rail', function() {
19 // The computeNormalizedPain regions are delineated at these FPS values. 19 // The computeNormalizedComfort regions are delineated at these FPS values.
20 var PAIN_FPS_REGIONS = [60, 40, 30, 10]; 20 var COMFORT_FPS_REGIONS = [60, 40, 30, 10];
21 21
22 // A frame is long if it starts more than this much time after the previous 22 // A frame is long if it starts more than this much time after the previous
23 // frame. 23 // frame.
24 var LONG_FRAME_MS = 50; 24 var LONG_FRAME_MS = 50;
25 25
26 // The computeNormalizedPain regions are delineated at these relative 26 // The computeNormalizedComfort regions are delineated at these relative
27 // discrepancy values. 27 // discrepancy values.
28 var PAIN_JANK_REGIONS = [0.05, 0.1, 0.2, 0.3]; 28 var COMFORT_JANK_REGIONS = [0.05, 0.1, 0.2, 0.3];
29 29
30 function AnimationInteractionRecord(start, duration) { 30 function AnimationInteractionRecord(start, duration) {
31 tr.e.rail.RAILInteractionRecord.call( 31 tr.e.rail.RAILInteractionRecord.call(
32 this, 'Animation', 'rail_animate', 32 this, 'Animation', 'rail_animate',
33 start, duration); 33 start, duration);
34 this.frameEvents_ = undefined; 34 this.frameEvents_ = undefined;
35 } 35 }
36 36
37 AnimationInteractionRecord.prototype = { 37 AnimationInteractionRecord.prototype = {
38 __proto__: tr.e.rail.RAILInteractionRecord.prototype, 38 __proto__: tr.e.rail.RAILInteractionRecord.prototype,
39 39
40 get frameEvents() { 40 get frameEvents() {
41 if (this.frameEvents_) 41 if (this.frameEvents_)
42 return this.frameEvents_; 42 return this.frameEvents_;
43 43
44 this.frameEvents_ = new tr.model.EventSet(); 44 this.frameEvents_ = new tr.model.EventSet();
45 45
46 this.associatedEvents.forEach(function(event) { 46 this.associatedEvents.forEach(function(event) {
47 if (event.title === tr.e.audits.IMPL_RENDERING_STATS) 47 if (event.title === tr.e.audits.IMPL_RENDERING_STATS)
48 this.frameEvents_.push(event); 48 this.frameEvents_.push(event);
49 }, this); 49 }, this);
50 50
51 return this.frameEvents_; 51 return this.frameEvents_;
52 }, 52 },
53 53
54 get normalizedUserPain() { 54 get normalizedUserComfort() {
55 return tr.e.rail.weightedAverage2( 55 return tr.e.rail.weightedAverage2(
56 this.normalizedJankPain, this.normalizedFPSPain); 56 this.normalizedJankComfort, this.normalizedFPSComfort);
57 }, 57 },
58 58
59 get normalizedFPSPain() { 59 get normalizedFPSComfort() {
60 var durationSeconds = this.duration / 1000; 60 var durationSeconds = this.duration / 1000;
61 var avgFps = this.frameEvents.length / durationSeconds; 61 var avgSpf = durationSeconds / this.frameEvents.length;
62 var avgSpf = 1 / avgFps; 62 return 1 - tr.e.rail.computeNormalizedComfort(avgSpf, {
63 return tr.e.rail.computeNormalizedPain(avgSpf, { 63 minValueExponential: 1 / COMFORT_FPS_REGIONS[0],
64 minValueExponential: 1 / PAIN_FPS_REGIONS[0], 64 minValueLinear: 1 / COMFORT_FPS_REGIONS[1],
65 minValueLinear: 1 / PAIN_FPS_REGIONS[1], 65 minValueLogarithmic: 1 / COMFORT_FPS_REGIONS[2],
66 minValueLogarithmic: 1 / PAIN_FPS_REGIONS[2], 66 maxValue: 1 / COMFORT_FPS_REGIONS[3]
67 maxValue: 1 / PAIN_FPS_REGIONS[3]
68 }); 67 });
69 }, 68 },
70 69
71 get normalizedJankPain() { 70 get normalizedJankComfort() {
72 var frameTimestamps = this.frameEvents.toArray().map(function(event) { 71 var frameTimestamps = this.frameEvents.toArray().map(function(event) {
73 return event.start; 72 return event.start;
74 }); 73 });
75 var absolute = false; 74 var absolute = false;
76 var discrepancy = tr.b.Statistics.timestampsDiscrepancy( 75 var discrepancy = tr.b.Statistics.timestampsDiscrepancy(
77 frameTimestamps, absolute); 76 frameTimestamps, absolute);
78 return tr.e.rail.computeNormalizedPain(discrepancy, { 77 return 1 - tr.e.rail.computeNormalizedComfort(discrepancy, {
79 minValueExponential: PAIN_JANK_REGIONS[0], 78 minValueExponential: COMFORT_JANK_REGIONS[0],
80 minValueLinear: PAIN_JANK_REGIONS[1], 79 minValueLinear: COMFORT_JANK_REGIONS[1],
81 minValueLogarithmic: PAIN_JANK_REGIONS[2], 80 minValueLogarithmic: COMFORT_JANK_REGIONS[2],
82 maxValue: PAIN_JANK_REGIONS[3] 81 maxValue: COMFORT_JANK_REGIONS[3]
83 }); 82 });
84 } 83 }
85 }; 84 };
86 85
87 return { 86 return {
88 AnimationInteractionRecord: AnimationInteractionRecord 87 AnimationInteractionRecord: AnimationInteractionRecord
89 }; 88 };
90 }); 89 });
91 </script> 90 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/extras/rail/animation_interaction_record_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698