| OLD | NEW |
| 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/metrics/metric_registry.html"> | 9 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
| 10 <link rel="import" href="/tracing/metrics/system_health/utils.html"> | 10 <link rel="import" href="/tracing/metrics/system_health/utils.html"> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 {relatedEvents: new tr.v.d.RelatedEventSet([ue])}); | 84 {relatedEvents: new tr.v.d.RelatedEventSet([ue])}); |
| 85 | 85 |
| 86 // Responsiveness is not defined for Idle or Startup expectations. | 86 // Responsiveness is not defined for Idle or Startup expectations. |
| 87 if (ue instanceof tr.model.um.IdleExpectation) { | 87 if (ue instanceof tr.model.um.IdleExpectation) { |
| 88 return; | 88 return; |
| 89 } else if (ue instanceof tr.model.um.StartupExpectation) { | 89 } else if (ue instanceof tr.model.um.StartupExpectation) { |
| 90 return; | 90 return; |
| 91 } else if (ue instanceof tr.model.um.LoadExpectation) { | 91 } else if (ue instanceof tr.model.um.LoadExpectation) { |
| 92 // This is already covered by loadingMetric. | 92 // This is already covered by loadingMetric. |
| 93 } else if (ue instanceof tr.model.um.ResponseExpectation) { | 93 } else if (ue instanceof tr.model.um.ResponseExpectation) { |
| 94 responseNumeric.add(ue.duration, sampleDiagnosticMap); | 94 responseNumeric.addSample(ue.duration, sampleDiagnosticMap); |
| 95 } else if (ue instanceof tr.model.um.AnimationExpectation) { | 95 } else if (ue instanceof tr.model.um.AnimationExpectation) { |
| 96 if (ue.frameEvents === undefined || ue.frameEvents.length === 0) { | 96 if (ue.frameEvents === undefined || ue.frameEvents.length === 0) { |
| 97 // Ignore animation stages that do not have associated frames: | 97 // Ignore animation stages that do not have associated frames: |
| 98 // https://github.com/catapult-project/catapult/issues/2446 | 98 // https://github.com/catapult-project/catapult/issues/2446 |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 var throughput = computeAnimationThroughput(ue); | 101 var throughput = computeAnimationThroughput(ue); |
| 102 if (throughput === undefined) | 102 if (throughput === undefined) |
| 103 throw new Error('Missing throughput for ' + | 103 throw new Error('Missing throughput for ' + |
| 104 ue.stableId); | 104 ue.stableId); |
| 105 | 105 |
| 106 throughputNumeric.add(throughput, sampleDiagnosticMap); | 106 throughputNumeric.addSample(throughput, sampleDiagnosticMap); |
| 107 | 107 |
| 108 var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue); | 108 var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue); |
| 109 if (frameTimeDiscrepancy === undefined) | 109 if (frameTimeDiscrepancy === undefined) |
| 110 throw new Error('Missing frameTimeDiscrepancy for ' + | 110 throw new Error('Missing frameTimeDiscrepancy for ' + |
| 111 ue.stableId); | 111 ue.stableId); |
| 112 | 112 |
| 113 frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, | 113 frameTimeDiscrepancyNumeric.addSample( |
| 114 sampleDiagnosticMap); | 114 frameTimeDiscrepancy, sampleDiagnosticMap); |
| 115 | 115 |
| 116 ue.associatedEvents.forEach(function(event) { | 116 ue.associatedEvents.forEach(function(event) { |
| 117 if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice)) | 117 if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice)) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 latencyNumeric.add(event.duration, sampleDiagnosticMap); | 120 latencyNumeric.addSample(event.duration, sampleDiagnosticMap); |
| 121 }); | 121 }); |
| 122 } else { | 122 } else { |
| 123 throw new Error('Unrecognized stage for ' + ue.stableId); | 123 throw new Error('Unrecognized stage for ' + ue.stableId); |
| 124 } | 124 } |
| 125 }); | 125 }); |
| 126 | 126 |
| 127 [ | 127 [ |
| 128 responseNumeric, throughputNumeric, frameTimeDiscrepancyNumeric, | 128 responseNumeric, throughputNumeric, frameTimeDiscrepancyNumeric, |
| 129 latencyNumeric | 129 latencyNumeric |
| 130 ].forEach(function(numeric) { | 130 ].forEach(function(numeric) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 149 | 149 |
| 150 tr.metrics.MetricRegistry.register(responsivenessMetric, { | 150 tr.metrics.MetricRegistry.register(responsivenessMetric, { |
| 151 supportsRangeOfInterest: true | 151 supportsRangeOfInterest: true |
| 152 }); | 152 }); |
| 153 | 153 |
| 154 return { | 154 return { |
| 155 responsivenessMetric: responsivenessMetric, | 155 responsivenessMetric: responsivenessMetric, |
| 156 }; | 156 }; |
| 157 }); | 157 }); |
| 158 </script> | 158 </script> |
| OLD | NEW |