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"> |
11 <link rel="import" href="/tracing/model/user_model/animation_expectation.html"> | 11 <link rel="import" href="/tracing/model/user_model/animation_expectation.html"> |
12 <link rel="import" href="/tracing/model/user_model/load_expectation.html"> | 12 <link rel="import" href="/tracing/model/user_model/load_expectation.html"> |
13 <link rel="import" href="/tracing/model/user_model/response_expectation.html"> | 13 <link rel="import" href="/tracing/model/user_model/response_expectation.html"> |
14 <link rel="import" href="/tracing/value/histogram.html"> | 14 <link rel="import" href="/tracing/value/histogram.html"> |
15 <link rel="import" href="/tracing/value/value.html"> | |
16 | 15 |
17 <script> | 16 <script> |
18 'use strict'; | 17 'use strict'; |
19 | 18 |
20 tr.exportTo('tr.metrics.sh', function() { | 19 tr.exportTo('tr.metrics.sh', function() { |
21 // In the case of Response, Load, and DiscreteAnimation IRs, Responsiveness is | 20 // In the case of Response, Load, and DiscreteAnimation IRs, Responsiveness is |
22 // derived from the time between when the user thinks they begin an interation | 21 // derived from the time between when the user thinks they begin an interation |
23 // (expectedStart) and the time when the screen first changes to reflect the | 22 // (expectedStart) and the time when the screen first changes to reflect the |
24 // interaction (actualEnd). There may be a delay between expectedStart and | 23 // interaction (actualEnd). There may be a delay between expectedStart and |
25 // when chrome first starts processing the interaction (actualStart) if the | 24 // when chrome first starts processing the interaction (actualStart) if the |
(...skipping 27 matching lines...) Expand all Loading... |
53 var absolute = true; | 52 var absolute = true; |
54 return tr.b.Statistics.timestampsDiscrepancy(frameTimestamps, absolute); | 53 return tr.b.Statistics.timestampsDiscrepancy(frameTimestamps, absolute); |
55 } | 54 } |
56 | 55 |
57 /** | 56 /** |
58 * @param {!tr.v.ValueSet} values | 57 * @param {!tr.v.ValueSet} values |
59 * @param {!tr.model.Model} model | 58 * @param {!tr.model.Model} model |
60 * @param {!Object=} opt_options | 59 * @param {!Object=} opt_options |
61 */ | 60 */ |
62 function responsivenessMetric(values, model, opt_options) { | 61 function responsivenessMetric(values, model, opt_options) { |
63 var responseNumeric = new tr.v.Histogram( | 62 var responseNumeric = new tr.v.Histogram('response latency', |
64 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | 63 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, |
65 tr.v.HistogramBinBoundaries.createLinear(100, 1e3, 50)); | 64 tr.v.HistogramBinBoundaries.createLinear(100, 1e3, 50)); |
66 var throughputNumeric = new tr.v.Histogram( | 65 var throughputNumeric = new tr.v.Histogram('animation throughput', |
67 tr.b.Unit.byName.unitlessNumber_biggerIsBetter, | 66 tr.b.Unit.byName.unitlessNumber_biggerIsBetter, |
68 tr.v.HistogramBinBoundaries.createLinear(10, 60, 10)); | 67 tr.v.HistogramBinBoundaries.createLinear(10, 60, 10)); |
69 var frameTimeDiscrepancyNumeric = new tr.v.Histogram( | 68 var frameTimeDiscrepancyNumeric = new tr.v.Histogram( |
| 69 'animation frameTimeDiscrepancy', |
70 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | 70 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, |
71 tr.v.HistogramBinBoundaries.createLinear(0, 1e3, 50). | 71 tr.v.HistogramBinBoundaries.createLinear(0, 1e3, 50). |
72 addExponentialBins(1e4, 10)); | 72 addExponentialBins(1e4, 10)); |
73 var latencyNumeric = new tr.v.Histogram( | 73 var latencyNumeric = new tr.v.Histogram('animation latency', |
74 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | 74 tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, |
75 tr.v.HistogramBinBoundaries.createLinear(0, 300, 60)); | 75 tr.v.HistogramBinBoundaries.createLinear(0, 300, 60)); |
76 | 76 |
77 model.userModel.expectations.forEach(function(ue) { | 77 model.userModel.expectations.forEach(function(ue) { |
78 if (opt_options && opt_options.rangeOfInterest && | 78 if (opt_options && opt_options.rangeOfInterest && |
79 !opt_options.rangeOfInterest.intersectsExplicitRangeInclusive( | 79 !opt_options.rangeOfInterest.intersectsExplicitRangeInclusive( |
80 ue.start, ue.end)) | 80 ue.start, ue.end)) |
81 return; | 81 return; |
82 | 82 |
83 var sampleDiagnosticMap = tr.v.d.DiagnosticMap.fromObject( | 83 var sampleDiagnosticMap = tr.v.d.DiagnosticMap.fromObject( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 latencyNumeric | 129 latencyNumeric |
130 ].forEach(function(numeric) { | 130 ].forEach(function(numeric) { |
131 numeric.customizeSummaryOptions({ | 131 numeric.customizeSummaryOptions({ |
132 avg: true, | 132 avg: true, |
133 max: true, | 133 max: true, |
134 min: true, | 134 min: true, |
135 std: true | 135 std: true |
136 }); | 136 }); |
137 }); | 137 }); |
138 | 138 |
139 values.addValue(new tr.v.NumericValue( | 139 values.addHistogram(responseNumeric); |
140 'response latency', responseNumeric)); | 140 values.addHistogram(throughputNumeric); |
141 values.addValue(new tr.v.NumericValue( | 141 values.addHistogram(frameTimeDiscrepancyNumeric); |
142 'animation throughput', throughputNumeric)); | 142 values.addHistogram(latencyNumeric); |
143 values.addValue(new tr.v.NumericValue( | |
144 'animation frameTimeDiscrepancy', | |
145 frameTimeDiscrepancyNumeric)); | |
146 values.addValue(new tr.v.NumericValue( | |
147 'animation latency', latencyNumeric)); | |
148 } | 143 } |
149 | 144 |
150 tr.metrics.MetricRegistry.register(responsivenessMetric, { | 145 tr.metrics.MetricRegistry.register(responsivenessMetric, { |
151 supportsRangeOfInterest: true | 146 supportsRangeOfInterest: true |
152 }); | 147 }); |
153 | 148 |
154 return { | 149 return { |
155 responsivenessMetric: responsivenessMetric, | 150 responsivenessMetric: responsivenessMetric, |
156 }; | 151 }; |
157 }); | 152 }); |
158 </script> | 153 </script> |
OLD | NEW |