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

Side by Side Diff: tracing/tracing/metrics/system_health/memory_metric.html

Issue 2204213002: [system-health] Report V8 heap space sizes in the memory metric. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: revert to PS 8 Created 4 years, 4 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
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/memory_metric_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/iteration_helpers.html"> 8 <link rel="import" href="/tracing/base/iteration_helpers.html">
9 <link rel="import" href="/tracing/base/multi_dimensional_view.html"> 9 <link rel="import" href="/tracing/base/multi_dimensional_view.html">
10 <link rel="import" href="/tracing/base/range.html"> 10 <link rel="import" href="/tracing/base/range.html">
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 function(propertyName, descriptionPrefixBuilder) { 263 function(propertyName, descriptionPrefixBuilder) {
264 addProcessScalar({ 264 addProcessScalar({
265 source: 'reported_by_chrome', 265 source: 'reported_by_chrome',
266 component: [rootAllocatorDump.name], 266 component: [rootAllocatorDump.name],
267 property: propertyName, 267 property: propertyName,
268 value: rootAllocatorDump.numerics[propertyName], 268 value: rootAllocatorDump.numerics[propertyName],
269 descriptionPrefixBuilder: descriptionPrefixBuilder 269 descriptionPrefixBuilder: descriptionPrefixBuilder
270 }); 270 });
271 }); 271 });
272 }); 272 });
273
273 // Add memory:<browser-name>:<process-name>:reported_by_chrome:v8: 274 // Add memory:<browser-name>:<process-name>:reported_by_chrome:v8:
274 // allocated_by_malloc:effective_size when available. 275 // {heap, allocated_by_malloc}:...
275 var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8'); 276 addV8MemoryDumpValues(processDump, addProcessScalar);
276 if (v8Dump !== undefined) {
277 var allocatedByMalloc = 0;
278 var peakAllocatedByMalloc = 0;
279 var hasMallocDump = false;
280 v8Dump.children.forEach(function(isolateDump) {
281 var mallocDump =
282 isolateDump.getDescendantDumpByFullName('malloc');
283 if (mallocDump === undefined)
284 return;
285 if (mallocDump.numerics['effective_size'] !== undefined) {
286 allocatedByMalloc +=
287 mallocDump.numerics['effective_size'].value;
288 }
289 if (mallocDump.numerics['peak_size'] !== undefined)
290 peakAllocatedByMalloc += mallocDump.numerics['peak_size'].value;
291 hasMallocDump = true;
292 });
293 if (hasMallocDump) {
294 addProcessScalar({
295 source: 'reported_by_chrome',
296 component: ['v8', 'allocated_by_malloc'],
297 property: 'effective_size',
298 value: allocatedByMalloc,
299 unit: sizeInBytes_smallerIsBetter,
300 descriptionPrefixBuilder:
301 CHROME_VALUE_PROPERTIES['effective_size']
302 });
303 addProcessScalar({
304 source: 'reported_by_chrome',
305 component: ['v8', 'allocated_by_malloc'],
306 property: 'peak_size',
307 value: peakAllocatedByMalloc,
308 unit: sizeInBytes_smallerIsBetter,
309 descriptionPrefixBuilder:
310 CHROME_VALUE_PROPERTIES['peak_size']
311 });
312 }
313 }
314 }, 277 },
315 function(componentTree) { 278 function(componentTree) {
316 // Subtract memory:<browser-name>:<process-name>:reported_by_chrome: 279 // Subtract memory:<browser-name>:<process-name>:reported_by_chrome:
317 // tracing:<size-property> from memory:<browser-name>:<process-name>: 280 // tracing:<size-property> from memory:<browser-name>:<process-name>:
318 // reported_by_chrome:<size-property> if applicable. 281 // reported_by_chrome:<size-property> if applicable.
319 var tracingNode = componentTree.children[1].get('tracing'); 282 var tracingNode = componentTree.children[1].get('tracing');
320 if (tracingNode === undefined) 283 if (tracingNode === undefined)
321 return; 284 return;
322 for (var i = 0; i < componentTree.values.length; i++) 285 for (var i = 0; i < componentTree.values.length; i++)
323 componentTree.values[i].total -= tracingNode.values[i].total; 286 componentTree.values[i].total -= tracingNode.values[i].total;
324 }, values); 287 }, values);
325 } 288 }
326 289
327 /** 290 /**
291 * Add memory dump values calculated from V8 components excluding
292 * 'heap_spaces/other_spaces'.
293 *
294 * @param {!tr.model.ProcessMemoryDump} processDump The process memory dump.
295 * @param {!function} addProcessScalar The callback for adding a scalar value.
296 */
297 function addV8MemoryDumpValues(processDump, addProcessScalar) {
298 var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
299 if (v8Dump === undefined)
300 return;
301 v8Dump.children.forEach(function(isolateDump) {
302 // v8:allocated_by_malloc:...
303 var mallocDump = isolateDump.getDescendantDumpByFullName('malloc');
304 if (mallocDump !== undefined) {
305 addV8ComponentValues(mallocDump, ['v8', 'allocated_by_malloc'],
306 addProcessScalar);
307 }
308 // v8:heap:...
309 var heapDump = isolateDump.getDescendantDumpByFullName('heap_spaces');
310 if (heapDump !== undefined) {
311 addV8ComponentValues(heapDump, ['v8', 'heap'], addProcessScalar);
312 heapDump.children.forEach(function(spaceDump) {
313 if (spaceDump.name === 'other_spaces')
314 return;
315 addV8ComponentValues(spaceDump, ['v8', 'heap', spaceDump.name],
316 addProcessScalar);
317 });
318 }
319 });
320 }
321
322 /**
323 * Add memory dump values calculated from the specified V8 component.
324 *
325 * @param {!tr.model.MemoryAllocatorDump} v8Dump The V8 memory dump.
326 * @param {!Array<string>} componentPath The component path for reporting.
327 * @param {!function} addProcessScalar The callback for adding a scalar value.
328 */
329 function addV8ComponentValues(componentDump, componentPath,
330 addProcessScalar) {
331 tr.b.iterItems(CHROME_VALUE_PROPERTIES,
332 function(propertyName, descriptionPrefixBuilder) {
333 addProcessScalar({
334 source: 'reported_by_chrome',
335 component: componentPath,
336 property: propertyName,
337 value: componentDump.numerics[propertyName],
338 descriptionPrefixBuilder: descriptionPrefixBuilder
339 });
340 });
341 }
342
343 /**
328 * Build a description prefix for a memory:<browser-name>:<process-name>: 344 * Build a description prefix for a memory:<browser-name>:<process-name>:
329 * process_count value. 345 * process_count value.
330 * 346 *
331 * @param {!Array<string>} componentPath The underlying component path (must 347 * @param {!Array<string>} componentPath The underlying component path (must
332 * be empty). 348 * be empty).
333 * @param {string} processName The canonical name of the process. 349 * @param {string} processName The canonical name of the process.
334 * @return {string} Prefix for the value's description (always 350 * @return {string} Prefix for the value's description (always
335 * 'total number of renderer processes'). 351 * 'total number of renderer processes').
336 */ 352 */
337 function buildProcessCountDescriptionPrefix(componentPath, processName) { 353 function buildProcessCountDescriptionPrefix(componentPath, processName) {
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1086
1071 tr.metrics.MetricRegistry.register(memoryMetric, { 1087 tr.metrics.MetricRegistry.register(memoryMetric, {
1072 supportsRangeOfInterest: true 1088 supportsRangeOfInterest: true
1073 }); 1089 });
1074 1090
1075 return { 1091 return {
1076 memoryMetric: memoryMetric 1092 memoryMetric: memoryMetric
1077 }; 1093 };
1078 }); 1094 });
1079 </script> 1095 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/memory_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698