OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 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 <link rel="import" href="/tracing/base/range.html"> | 7 <link rel="import" href="/tracing/base/range.html"> |
8 <link rel="import" href="/tracing/metrics/metric_registry.html"> | 8 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
9 <link rel="import" href="/tracing/metrics/v8/utils.html"> | 9 <link rel="import" href="/tracing/metrics/v8/utils.html"> |
10 <link rel="import" href="/tracing/value/histogram.html"> | 10 <link rel="import" href="/tracing/value/histogram.html"> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 std: false, | 74 std: false, |
75 sum: true, | 75 sum: true, |
76 percentile: [] | 76 percentile: [] |
77 }); | 77 }); |
78 return n; | 78 return n; |
79 } | 79 } |
80 | 80 |
81 function createPercentage(numerator, denominator) { | 81 function createPercentage(numerator, denominator) { |
82 var histogram = new tr.v.Histogram(percentage_biggerIsBetter); | 82 var histogram = new tr.v.Histogram(percentage_biggerIsBetter); |
83 if (denominator === 0) | 83 if (denominator === 0) |
84 histogram.add(0); | 84 histogram.addSample(0); |
85 else | 85 else |
86 histogram.add(numerator / denominator); | 86 histogram.addSample(numerator / denominator); |
87 return histogram; | 87 return histogram; |
88 } | 88 } |
89 | 89 |
90 /** | 90 /** |
91 * Example output: | 91 * Example output: |
92 * - blink-gc-marking. | 92 * - blink-gc-marking. |
93 */ | 93 */ |
94 function addDurationOfTopEvents(values, model) { | 94 function addDurationOfTopEvents(values, model) { |
95 tr.metrics.v8.utils.groupAndProcessEvents(model, | 95 tr.metrics.v8.utils.groupAndProcessEvents(model, |
96 isBlinkGarbageCollectionEvent, | 96 isBlinkGarbageCollectionEvent, |
97 blinkGarbageCollectionEventName, | 97 blinkGarbageCollectionEventName, |
98 function(name, events) { | 98 function(name, events) { |
99 var cpuDuration = createNumericForTopEventTime(); | 99 var cpuDuration = createNumericForTopEventTime(); |
100 events.forEach(function(event) { | 100 events.forEach(function(event) { |
101 cpuDuration.add(event.cpuDuration); | 101 cpuDuration.addSample(event.cpuDuration); |
102 }); | 102 }); |
103 values.addValue(new tr.v.NumericValue(name, cpuDuration)); | 103 values.addValue(new tr.v.NumericValue(name, cpuDuration)); |
104 } | 104 } |
105 ); | 105 ); |
106 } | 106 } |
107 | 107 |
108 /** | 108 /** |
109 * Example output: | 109 * Example output: |
110 * - blink-gc-total | 110 * - blink-gc-total |
111 */ | 111 */ |
112 function addTotalDurationOfTopEvents(values, model) { | 112 function addTotalDurationOfTopEvents(values, model) { |
113 tr.metrics.v8.utils.groupAndProcessEvents(model, | 113 tr.metrics.v8.utils.groupAndProcessEvents(model, |
114 isBlinkGarbageCollectionEvent, | 114 isBlinkGarbageCollectionEvent, |
115 event => 'blink-gc-total', | 115 event => 'blink-gc-total', |
116 function(name, events) { | 116 function(name, events) { |
117 var cpuDuration = createNumericForTopEventTime(); | 117 var cpuDuration = createNumericForTopEventTime(); |
118 events.forEach(function(event) { | 118 events.forEach(function(event) { |
119 cpuDuration.add(event.cpuDuration); | 119 cpuDuration.addSample(event.cpuDuration); |
120 }); | 120 }); |
121 values.addValue(new tr.v.NumericValue(name, cpuDuration)); | 121 values.addValue(new tr.v.NumericValue(name, cpuDuration)); |
122 } | 122 } |
123 ); | 123 ); |
124 } | 124 } |
125 | 125 |
126 /** | 126 /** |
127 * Example output: | 127 * Example output: |
128 * - blink-gc-marking_idle_deadline_overrun, | 128 * - blink-gc-marking_idle_deadline_overrun, |
129 * - blink-gc-marking_outside_idle, | 129 * - blink-gc-marking_outside_idle, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Don't count time over the deadline as being inside idle time. | 172 // Don't count time over the deadline as being inside idle time. |
173 // Since the deadline should be relative to wall clock we | 173 // Since the deadline should be relative to wall clock we |
174 // compare allotted_time_ms with wall duration instead of thread | 174 // compare allotted_time_ms with wall duration instead of thread |
175 // duration, and then assume the thread duration was inside idle | 175 // duration, and then assume the thread duration was inside idle |
176 // for the same percentage of time. | 176 // for the same percentage of time. |
177 inside = event.cpuDuration * allottedTime / event.duration; | 177 inside = event.cpuDuration * allottedTime / event.duration; |
178 } else { | 178 } else { |
179 inside = event.cpuDuration; | 179 inside = event.cpuDuration; |
180 } | 180 } |
181 } | 181 } |
182 cpuDuration.add(event.cpuDuration); | 182 cpuDuration.addSample(event.cpuDuration); |
183 insideIdle.add(inside); | 183 insideIdle.addSample(inside); |
184 outsideIdle.add(event.cpuDuration - inside); | 184 outsideIdle.addSample(event.cpuDuration - inside); |
185 idleDeadlineOverrun.add(overrun); | 185 idleDeadlineOverrun.addSample(overrun); |
186 }); | 186 }); |
187 values.addValue(new tr.v.NumericValue( | 187 values.addValue(new tr.v.NumericValue( |
188 name + '_idle_deadline_overrun', | 188 name + '_idle_deadline_overrun', |
189 idleDeadlineOverrun)); | 189 idleDeadlineOverrun)); |
190 values.addValue(new tr.v.NumericValue( | 190 values.addValue(new tr.v.NumericValue( |
191 name + '_outside_idle', outsideIdle)); | 191 name + '_outside_idle', outsideIdle)); |
192 var percentage = createPercentage(insideIdle.sum, | 192 var percentage = createPercentage(insideIdle.sum, |
193 cpuDuration.sum); | 193 cpuDuration.sum); |
194 values.addValue(new tr.v.NumericValue( | 194 values.addValue(new tr.v.NumericValue( |
195 name + '_percentage_idle', percentage)); | 195 name + '_percentage_idle', percentage)); |
196 } | 196 } |
197 | 197 |
198 return { | 198 return { |
199 blinkGcMetric: blinkGcMetric | 199 blinkGcMetric: blinkGcMetric |
200 }; | 200 }; |
201 }); | 201 }); |
202 </script> | 202 </script> |
OLD | NEW |