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

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

Issue 2153823002: [system-health] Track amount of malloced memory in V8. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 5 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 value: 1, 252 value: 1,
253 unit: unitlessNumber_smallerIsBetter, 253 unit: unitlessNumber_smallerIsBetter,
254 descriptionPrefixBuilder: buildProcessCountDescriptionPrefix 254 descriptionPrefixBuilder: buildProcessCountDescriptionPrefix
255 }); 255 });
256 256
257 // Add memory:<browser-name>:<process-name>:reported_by_chrome:... 257 // Add memory:<browser-name>:<process-name>:reported_by_chrome:...
258 // values. 258 // values.
259 if (processDump.memoryAllocatorDumps === undefined) 259 if (processDump.memoryAllocatorDumps === undefined)
260 return; 260 return;
261 processDump.memoryAllocatorDumps.forEach(function(rootAllocatorDump) { 261 processDump.memoryAllocatorDumps.forEach(function(rootAllocatorDump) {
262 CHROME_VALUE_PROPERTIES.forEach(function(spec) { 262 tr.b.iterItems(CHROME_VALUE_PROPERTIES,
263 function(propertyName, descriptionPrefixBuilder) {
264 addProcessScalar({
265 source: 'reported_by_chrome',
266 component: [rootAllocatorDump.name],
267 property: propertyName,
268 value: rootAllocatorDump.numerics[propertyName],
269 descriptionPrefixBuilder: descriptionPrefixBuilder
270 });
271 });
272 });
273 // Add memory:<browser-name>:<process-name>:reported_by_chrome:v8:
274 // allocated_by_malloc:effective_size when available.
275 var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
276 if (v8Dump !== undefined) {
277 var allocatedByMalloc = 0;
278 var hasMallocDump = false;
279 v8Dump.children.forEach(function(isolateDump) {
280 var mallocDump =
281 isolateDump.getDescendantDumpByFullName('malloc');
282 if (mallocDump === undefined ||
283 mallocDump.numerics['effective_size'] === undefined) {
284 return;
285 }
286 allocatedByMalloc += mallocDump.numerics['effective_size'].value;
287 hasMallocDump = true;
288 });
289 if (hasMallocDump) {
263 addProcessScalar({ 290 addProcessScalar({
264 source: 'reported_by_chrome', 291 source: 'reported_by_chrome',
265 component: [rootAllocatorDump.name], 292 component: ['v8', 'allocated_by_malloc'],
266 property: spec.propertyName, 293 property: 'effective_size',
267 value: rootAllocatorDump.numerics[spec.propertyName], 294 value: allocatedByMalloc,
268 descriptionPrefixBuilder: spec.descriptionPrefixBuilder 295 unit: sizeInBytes_smallerIsBetter,
296 descriptionPrefixBuilder:
297 CHROME_VALUE_PROPERTIES['effective_size']
269 }); 298 });
270 }); 299 }
271 }); 300 }
272 }, 301 },
273 function(componentTree) { 302 function(componentTree) {
274 // Subtract memory:<browser-name>:<process-name>:reported_by_chrome: 303 // Subtract memory:<browser-name>:<process-name>:reported_by_chrome:
275 // tracing:<size-property> from memory:<browser-name>:<process-name>: 304 // tracing:<size-property> from memory:<browser-name>:<process-name>:
276 // reported_by_chrome:<size-property> if applicable. 305 // reported_by_chrome:<size-property> if applicable.
277 var tracingNode = componentTree.children[1].get('tracing'); 306 var tracingNode = componentTree.children[1].get('tracing');
278 if (tracingNode === undefined) 307 if (tracingNode === undefined)
279 return; 308 return;
280 for (var i = 0; i < componentTree.values.length; i++) 309 for (var i = 0; i < componentTree.values.length; i++)
281 componentTree.values[i].total -= tracingNode.values[i].total; 310 componentTree.values[i].total -= tracingNode.values[i].total;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 nameParts.push(formatSpec.userFriendlyPropertyNamePrefix); 367 nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
339 nameParts.push(componentPath.join(':')); 368 nameParts.push(componentPath.join(':'));
340 nameParts.push(formatSpec.userFriendlyPropertyName); 369 nameParts.push(formatSpec.userFriendlyPropertyName);
341 } else { 370 } else {
342 // Use component name as a noun with a preposition 371 // Use component name as a noun with a preposition
343 // (e.g. 'size of all objects allocated BY MALLOC'). 372 // (e.g. 'size of all objects allocated BY MALLOC').
344 if (formatSpec.userFriendlyPropertyNamePrefix) 373 if (formatSpec.userFriendlyPropertyNamePrefix)
345 nameParts.push(formatSpec.userFriendlyPropertyNamePrefix); 374 nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
346 nameParts.push(formatSpec.userFriendlyPropertyName); 375 nameParts.push(formatSpec.userFriendlyPropertyName);
347 nameParts.push(formatSpec.componentPreposition); 376 nameParts.push(formatSpec.componentPreposition);
348 nameParts.push(componentPath.join(':')); 377 if (componentPath[componentPath.length - 1] === 'allocated_by_malloc') {
378 nameParts.push('objects allocated by malloc for');
379 nameParts.push(
380 componentPath.slice(0, componentPath.length - 1).join(':'));
381 } else {
382 nameParts.push(componentPath.join(':'));
383 }
349 } 384 }
350 nameParts.push('in'); 385 nameParts.push('in');
351 } 386 }
352 nameParts.push(convertProcessNameToUserFriendlyName(processName)); 387 nameParts.push(convertProcessNameToUserFriendlyName(processName));
353 return nameParts.join(' '); 388 return nameParts.join(' ');
354 } 389 }
355 390
356 // Specifications of properties reported by Chrome. 391 // Specifications of properties reported by Chrome.
357 var CHROME_VALUE_PROPERTIES = [ 392 var CHROME_VALUE_PROPERTIES = {
358 { 393 'effective_size': buildChromeValueDescriptionPrefix.bind(undefined, {
359 propertyName: 'effective_size', 394 userFriendlyPropertyName: 'effective size',
360 descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind( 395 componentPreposition: 'of'
361 undefined, { 396 }),
362 userFriendlyPropertyName: 'effective size', 397 'allocated_objects_size': buildChromeValueDescriptionPrefix.bind(
363 componentPreposition: 'of' 398 undefined, {
364 }) 399 userFriendlyPropertyName: 'size of all objects allocated',
365 }, 400 totalUserFriendlyPropertyName: 'size of all allocated objects',
366 { 401 componentPreposition: 'by'
367 propertyName: 'allocated_objects_size', 402 }),
368 descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind( 403 'locked_size': buildChromeValueDescriptionPrefix.bind(undefined, {
369 undefined, { 404 userFriendlyPropertyName: 'locked (pinned) size',
370 userFriendlyPropertyName: 'size of all objects allocated', 405 componentPreposition: 'of'
371 totalUserFriendlyPropertyName: 'size of all allocated objects', 406 })
372 componentPreposition: 'by' 407 };
373 })
374 },
375 {
376 propertyName: 'locked_size',
377 descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
378 undefined, {
379 userFriendlyPropertyName: 'locked (pinned) size',
380 componentPreposition: 'of'
381 })
382 }
383 ];
384 408
385 /** 409 /**
386 * Add heavy memory dump values calculated from heavy global memory dumps to 410 * Add heavy memory dump values calculated from heavy global memory dumps to
387 * |values|. In particular, this function adds the following values: 411 * |values|. In particular, this function adds the following values:
388 * 412 *
389 * * MEMORY USAGE REPORTED BY THE OS 413 * * MEMORY USAGE REPORTED BY THE OS
390 * memory:{chrome, webview}: 414 * memory:{chrome, webview}:
391 * {browser_process, renderer_processes, ..., all_processes}: 415 * {browser_process, renderer_processes, ..., all_processes}:
392 * reported_by_os:system_memory:[{ashmem, native_heap, java_heap}:] 416 * reported_by_os:system_memory:[{ashmem, native_heap, java_heap}:]
393 * {proportional_resident_size, private_dirty_size} 417 * {proportional_resident_size, private_dirty_size}
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 1053
1030 tr.metrics.MetricRegistry.register(memoryMetric, { 1054 tr.metrics.MetricRegistry.register(memoryMetric, {
1031 supportsRangeOfInterest: true 1055 supportsRangeOfInterest: true
1032 }); 1056 });
1033 1057
1034 return { 1058 return {
1035 memoryMetric: memoryMetric 1059 memoryMetric: memoryMetric
1036 }; 1060 };
1037 }); 1061 });
1038 </script> 1062 </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