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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // TODO(benjhayden): Add categories to benchmark to support: | 78 // TODO(benjhayden): Add categories to benchmark to support: |
79 // tr.metrics.sh.firstPaintMetric(values, model); | 79 // tr.metrics.sh.firstPaintMetric(values, model); |
80 | 80 |
81 var responseNumeric = RESPONSE_NUMERIC_BUILDER.build(); | 81 var responseNumeric = RESPONSE_NUMERIC_BUILDER.build(); |
82 var throughputNumeric = THROUGHPUT_NUMERIC_BUILDER.build(); | 82 var throughputNumeric = THROUGHPUT_NUMERIC_BUILDER.build(); |
83 var frameTimeDiscrepancyNumeric = DISCREPANCY_NUMERIC_BUILDER.build(); | 83 var frameTimeDiscrepancyNumeric = DISCREPANCY_NUMERIC_BUILDER.build(); |
84 var latencyNumeric = LATENCY_NUMERIC_BUILDER.build(); | 84 var latencyNumeric = LATENCY_NUMERIC_BUILDER.build(); |
85 | 85 |
86 model.userModel.expectations.forEach(function(ue) { | 86 model.userModel.expectations.forEach(function(ue) { |
87 if (opt_options && opt_options.rangeOfInterest && | 87 if (opt_options && opt_options.rangeOfInterest && |
88 !opt_options.rangeOfInterest.intersectsExplicitRangeExclusive( | 88 !opt_options.rangeOfInterest.intersectsExplicitRangeInclusive( |
89 ue.start, ue.end)) | 89 ue.start, ue.end)) |
90 return; | 90 return; |
91 | 91 |
92 var sourceInfo = {userExpectationId: ue.stableId}; | 92 var sampleDiagnostic = new tr.v.d.RelatedEventSet([ue]); |
93 | 93 |
94 // Responsiveness is not defined for Idle. | 94 // Responsiveness is not defined for Idle. |
95 if (ue instanceof tr.model.um.IdleExpectation) { | 95 if (ue instanceof tr.model.um.IdleExpectation) { |
96 return; | 96 return; |
97 } else if (ue instanceof tr.model.um.LoadExpectation) { | 97 } else if (ue instanceof tr.model.um.LoadExpectation) { |
98 // This is already covered by firstPaintMetric. | 98 // This is already covered by firstPaintMetric. |
99 } else if (ue instanceof tr.model.um.ResponseExpectation) { | 99 } else if (ue instanceof tr.model.um.ResponseExpectation) { |
100 responseNumeric.add(ue.duration, sourceInfo); | 100 responseNumeric.add(ue.duration, sampleDiagnostic); |
101 } else if (ue instanceof tr.model.um.AnimationExpectation) { | 101 } else if (ue instanceof tr.model.um.AnimationExpectation) { |
102 var throughput = computeAnimationThroughput(ue); | 102 var throughput = computeAnimationThroughput(ue); |
103 if (throughput === undefined) | 103 if (throughput === undefined) |
104 throw new Error('Missing throughput for ' + | 104 throw new Error('Missing throughput for ' + |
105 ue.stableId); | 105 ue.stableId); |
106 | 106 |
107 throughputNumeric.add(throughput, sourceInfo); | 107 throughputNumeric.add(throughput, sampleDiagnostic); |
108 | 108 |
109 var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue); | 109 var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue); |
110 if (frameTimeDiscrepancy === undefined) | 110 if (frameTimeDiscrepancy === undefined) |
111 throw new Error('Missing frameTimeDiscrepancy for ' + | 111 throw new Error('Missing frameTimeDiscrepancy for ' + |
112 ue.stableId); | 112 ue.stableId); |
113 | 113 |
114 frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, sourceInfo); | 114 frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, sampleDiagnostic); |
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, sourceInfo); | 120 latencyNumeric.add(event.duration, sampleDiagnostic); |
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 |