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

Side by Side Diff: tracing/tracing/metrics/v8/gc_metric.html

Issue 2283213002: Rename Histogram.add() to addSample(). (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 3 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
OLDNEW
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 7
8 <link rel="import" href="/tracing/base/range.html"> 8 <link rel="import" href="/tracing/base/range.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/v8/utils.html"> 10 <link rel="import" href="/tracing/metrics/v8/utils.html">
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 std: false, 83 std: false,
84 sum: true, 84 sum: true,
85 percentile: [] 85 percentile: []
86 }); 86 });
87 return n; 87 return n;
88 } 88 }
89 89
90 function createPercentage(numerator, denominator) { 90 function createPercentage(numerator, denominator) {
91 var hist = new tr.v.Histogram(percentage_biggerIsBetter); 91 var hist = new tr.v.Histogram(percentage_biggerIsBetter);
92 if (denominator === 0) 92 if (denominator === 0)
93 hist.add(0); 93 hist.addSample(0);
94 else 94 else
95 hist.add(numerator / denominator); 95 hist.addSample(numerator / denominator);
96 return hist; 96 return hist;
97 } 97 }
98 98
99 function isNotForcedTopGarbageCollectionEvent(event) { 99 function isNotForcedTopGarbageCollectionEvent(event) {
100 // We exclude garbage collection events forced by benchmark runner, 100 // We exclude garbage collection events forced by benchmark runner,
101 // because they cannot happen in real world. 101 // because they cannot happen in real world.
102 return tr.metrics.v8.utils.isTopGarbageCollectionEvent(event) && 102 return tr.metrics.v8.utils.isTopGarbageCollectionEvent(event) &&
103 !tr.metrics.v8.utils.isForcedGarbageCollectionEvent(event); 103 !tr.metrics.v8.utils.isForcedGarbageCollectionEvent(event);
104 } 104 }
105 105
106 function isNotForcedSubGarbageCollectionEvent(event) { 106 function isNotForcedSubGarbageCollectionEvent(event) {
107 // We exclude garbage collection events forced by benchmark runner, 107 // We exclude garbage collection events forced by benchmark runner,
108 // because they cannot happen in real world. 108 // because they cannot happen in real world.
109 return tr.metrics.v8.utils.isSubGarbageCollectionEvent(event) && 109 return tr.metrics.v8.utils.isSubGarbageCollectionEvent(event) &&
110 !tr.metrics.v8.utils.isForcedGarbageCollectionEvent(event); 110 !tr.metrics.v8.utils.isForcedGarbageCollectionEvent(event);
111 } 111 }
112 112
113 /** 113 /**
114 * Example output: 114 * Example output:
115 * - v8-gc-full-mark-compactor. 115 * - v8-gc-full-mark-compactor.
116 */ 116 */
117 function addDurationOfTopEvents(values, model) { 117 function addDurationOfTopEvents(values, model) {
118 tr.metrics.v8.utils.groupAndProcessEvents(model, 118 tr.metrics.v8.utils.groupAndProcessEvents(model,
119 isNotForcedTopGarbageCollectionEvent, 119 isNotForcedTopGarbageCollectionEvent,
120 tr.metrics.v8.utils.topGarbageCollectionEventName, 120 tr.metrics.v8.utils.topGarbageCollectionEventName,
121 function(name, events) { 121 function(name, events) {
122 var cpuDuration = createNumericForTopEventTime(); 122 var cpuDuration = createNumericForTopEventTime();
123 events.forEach(function(event) { 123 events.forEach(function(event) {
124 cpuDuration.add(event.cpuDuration); 124 cpuDuration.addSample(event.cpuDuration);
125 }); 125 });
126 values.addValue(new tr.v.NumericValue(name, cpuDuration)); 126 values.addValue(new tr.v.NumericValue(name, cpuDuration));
127 } 127 }
128 ); 128 );
129 } 129 }
130 130
131 /** 131 /**
132 * Example output: 132 * Example output:
133 * - v8-gc-total 133 * - v8-gc-total
134 */ 134 */
135 function addTotalDurationOfTopEvents(values, model) { 135 function addTotalDurationOfTopEvents(values, model) {
136 tr.metrics.v8.utils.groupAndProcessEvents(model, 136 tr.metrics.v8.utils.groupAndProcessEvents(model,
137 isNotForcedTopGarbageCollectionEvent, 137 isNotForcedTopGarbageCollectionEvent,
138 event => 'v8-gc-total', 138 event => 'v8-gc-total',
139 function(name, events) { 139 function(name, events) {
140 var cpuDuration = createNumericForTopEventTime(); 140 var cpuDuration = createNumericForTopEventTime();
141 events.forEach(function(event) { 141 events.forEach(function(event) {
142 cpuDuration.add(event.cpuDuration); 142 cpuDuration.addSample(event.cpuDuration);
143 }); 143 });
144 values.addValue(new tr.v.NumericValue(name, cpuDuration)); 144 values.addValue(new tr.v.NumericValue(name, cpuDuration));
145 } 145 }
146 ); 146 );
147 } 147 }
148 148
149 /** 149 /**
150 * Example output: 150 * Example output:
151 * - v8-gc-full-mark-compactor-evacuate. 151 * - v8-gc-full-mark-compactor-evacuate.
152 */ 152 */
153 function addDurationOfSubEvents(values, model) { 153 function addDurationOfSubEvents(values, model) {
154 tr.metrics.v8.utils.groupAndProcessEvents(model, 154 tr.metrics.v8.utils.groupAndProcessEvents(model,
155 isNotForcedSubGarbageCollectionEvent, 155 isNotForcedSubGarbageCollectionEvent,
156 tr.metrics.v8.utils.subGarbageCollectionEventName, 156 tr.metrics.v8.utils.subGarbageCollectionEventName,
157 function(name, events) { 157 function(name, events) {
158 var cpuDuration = createNumericForSubEventTime(); 158 var cpuDuration = createNumericForSubEventTime();
159 events.forEach(function(event) { 159 events.forEach(function(event) {
160 cpuDuration.add(event.cpuDuration); 160 cpuDuration.addSample(event.cpuDuration);
161 }); 161 });
162 values.addValue(new tr.v.NumericValue(name, cpuDuration)); 162 values.addValue(new tr.v.NumericValue(name, cpuDuration));
163 } 163 }
164 ); 164 );
165 } 165 }
166 166
167 /** 167 /**
168 * Example output: 168 * Example output:
169 * - v8-gc-full-mark-compactor_idle_deadline_overrun, 169 * - v8-gc-full-mark-compactor_idle_deadline_overrun,
170 * - v8-gc-full-mark-compactor_outside_idle, 170 * - v8-gc-full-mark-compactor_outside_idle,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Don't count time over the deadline as being inside idle time. 213 // Don't count time over the deadline as being inside idle time.
214 // Since the deadline should be relative to wall clock we 214 // Since the deadline should be relative to wall clock we
215 // compare allotted_time_ms with wall duration instead of thread 215 // compare allotted_time_ms with wall duration instead of thread
216 // duration, and then assume the thread duration was inside idle 216 // duration, and then assume the thread duration was inside idle
217 // for the same percentage of time. 217 // for the same percentage of time.
218 inside = event.cpuDuration * allottedTime / event.duration; 218 inside = event.cpuDuration * allottedTime / event.duration;
219 } else { 219 } else {
220 inside = event.cpuDuration; 220 inside = event.cpuDuration;
221 } 221 }
222 } 222 }
223 cpuDuration.add(event.cpuDuration); 223 cpuDuration.addSample(event.cpuDuration);
224 insideIdle.add(inside); 224 insideIdle.addSample(inside);
225 outsideIdle.add(event.cpuDuration - inside); 225 outsideIdle.addSample(event.cpuDuration - inside);
226 idleDeadlineOverrun.add(overrun); 226 idleDeadlineOverrun.addSample(overrun);
227 }); 227 });
228 values.addValue(new tr.v.NumericValue( 228 values.addValue(new tr.v.NumericValue(
229 name + '_idle_deadline_overrun', 229 name + '_idle_deadline_overrun',
230 idleDeadlineOverrun)); 230 idleDeadlineOverrun));
231 values.addValue(new tr.v.NumericValue( 231 values.addValue(new tr.v.NumericValue(
232 name + '_outside_idle', outsideIdle)); 232 name + '_outside_idle', outsideIdle));
233 var percentage = createPercentage(insideIdle.sum, 233 var percentage = createPercentage(insideIdle.sum,
234 cpuDuration.sum); 234 cpuDuration.sum);
235 values.addValue(new tr.v.NumericValue( 235 values.addValue(new tr.v.NumericValue(
236 name + '_percentage_idle', percentage)); 236 name + '_percentage_idle', percentage));
(...skipping 17 matching lines...) Expand all
254 } 254 }
255 } 255 }
256 time += topEvent.duration; 256 time += topEvent.duration;
257 } 257 }
258 // Now we have one big v8.execute interval from 0 to |time| and 258 // Now we have one big v8.execute interval from 0 to |time| and
259 // a list of GC pauses. 259 // a list of GC pauses.
260 var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization( 260 var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
261 0, time, WINDOW_SIZE_MS, pauses); 261 0, time, WINDOW_SIZE_MS, pauses);
262 [0.90, 0.95, 0.99].forEach(function(percent) { 262 [0.90, 0.95, 0.99].forEach(function(percent) {
263 var hist = new tr.v.Histogram(percentage_biggerIsBetter); 263 var hist = new tr.v.Histogram(percentage_biggerIsBetter);
264 hist.add(mutatorUtilization.percentile(1.0 - percent)); 264 hist.addSample(mutatorUtilization.percentile(1.0 - percent));
265 values.addValue(new tr.v.NumericValue( 265 values.addValue(new tr.v.NumericValue(
266 'v8-execute-mutator-utilization_pct_0' + percent * 100, 266 'v8-execute-mutator-utilization_pct_0' + percent * 100,
267 hist)); 267 hist));
268 }); 268 });
269 var hist = new tr.v.Histogram(percentage_biggerIsBetter); 269 var hist = new tr.v.Histogram(percentage_biggerIsBetter);
270 hist.add(mutatorUtilization.min); 270 hist.addSample(mutatorUtilization.min);
271 values.addValue(new tr.v.NumericValue( 271 values.addValue(new tr.v.NumericValue(
272 'v8-execute-mutator-utilization_min', hist)); 272 'v8-execute-mutator-utilization_min', hist));
273 } 273 }
274 ); 274 );
275 } 275 }
276 276
277 return { 277 return {
278 gcMetric: gcMetric, 278 gcMetric: gcMetric,
279 WINDOW_SIZE_MS: WINDOW_SIZE_MS // For testing purposes only. 279 WINDOW_SIZE_MS: WINDOW_SIZE_MS // For testing purposes only.
280 }; 280 };
281 }); 281 });
282 </script> 282 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/v8/execution_metric.html ('k') | tracing/tracing/value/diagnostics/composition.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698