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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/system_health/memory_metric.html
diff --git a/tracing/tracing/metrics/system_health/memory_metric.html b/tracing/tracing/metrics/system_health/memory_metric.html
index 8396e3241d189c3d3f203e0ac5276cc2c372dca8..10717233434b823b19af9e21a92e6abe92f0848b 100644
--- a/tracing/tracing/metrics/system_health/memory_metric.html
+++ b/tracing/tracing/metrics/system_health/memory_metric.html
@@ -270,47 +270,10 @@ tr.exportTo('tr.metrics.sh', function() {
});
});
});
+
// Add memory:<browser-name>:<process-name>:reported_by_chrome:v8:
- // allocated_by_malloc:effective_size when available.
- var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
- if (v8Dump !== undefined) {
- var allocatedByMalloc = 0;
- var peakAllocatedByMalloc = 0;
- var hasMallocDump = false;
- v8Dump.children.forEach(function(isolateDump) {
- var mallocDump =
- isolateDump.getDescendantDumpByFullName('malloc');
- if (mallocDump === undefined)
- return;
- if (mallocDump.numerics['effective_size'] !== undefined) {
- allocatedByMalloc +=
- mallocDump.numerics['effective_size'].value;
- }
- if (mallocDump.numerics['peak_size'] !== undefined)
- peakAllocatedByMalloc += mallocDump.numerics['peak_size'].value;
- hasMallocDump = true;
- });
- if (hasMallocDump) {
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8', 'allocated_by_malloc'],
- property: 'effective_size',
- value: allocatedByMalloc,
- unit: sizeInBytes_smallerIsBetter,
- descriptionPrefixBuilder:
- CHROME_VALUE_PROPERTIES['effective_size']
- });
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8', 'allocated_by_malloc'],
- property: 'peak_size',
- value: peakAllocatedByMalloc,
- unit: sizeInBytes_smallerIsBetter,
- descriptionPrefixBuilder:
- CHROME_VALUE_PROPERTIES['peak_size']
- });
- }
- }
+ // {heap, allocated_by_malloc}:...
+ addV8MemoryDumpValues(processDump, addProcessScalar);
},
function(componentTree) {
// Subtract memory:<browser-name>:<process-name>:reported_by_chrome:
@@ -325,6 +288,59 @@ tr.exportTo('tr.metrics.sh', function() {
}
/**
+ * Add memory dump values calculated from V8 components excluding
+ * 'heap_spaces/other_spaces'.
+ *
+ * @param {!tr.model.ProcessMemoryDump} processDump The process memory dump.
+ * @param {!function} addProcessScalar The callback for adding a scalar value.
+ */
+ function addV8MemoryDumpValues(processDump, addProcessScalar) {
+ var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
+ if (v8Dump === undefined)
+ return;
+ v8Dump.children.forEach(function(isolateDump) {
+ // v8:allocated_by_malloc:...
+ var mallocDump = isolateDump.getDescendantDumpByFullName('malloc');
+ if (mallocDump !== undefined) {
+ addV8ComponentValues(mallocDump, ['v8', 'allocated_by_malloc'],
+ addProcessScalar);
+ }
+ // v8:heap:...
+ var heapDump = isolateDump.getDescendantDumpByFullName('heap_spaces');
+ if (heapDump !== undefined) {
+ addV8ComponentValues(heapDump, ['v8', 'heap'], addProcessScalar);
+ heapDump.children.forEach(function(spaceDump) {
+ if (spaceDump.name === 'other_spaces')
+ return;
+ addV8ComponentValues(spaceDump, ['v8', 'heap', spaceDump.name],
+ addProcessScalar);
+ });
+ }
+ });
+ }
+
+ /**
+ * Add memory dump values calculated from the specified V8 component.
+ *
+ * @param {!tr.model.MemoryAllocatorDump} v8Dump The V8 memory dump.
+ * @param {!Array<string>} componentPath The component path for reporting.
+ * @param {!function} addProcessScalar The callback for adding a scalar value.
+ */
+ function addV8ComponentValues(componentDump, componentPath,
+ addProcessScalar) {
+ tr.b.iterItems(CHROME_VALUE_PROPERTIES,
+ function(propertyName, descriptionPrefixBuilder) {
+ addProcessScalar({
+ source: 'reported_by_chrome',
+ component: componentPath,
+ property: propertyName,
+ value: componentDump.numerics[propertyName],
+ descriptionPrefixBuilder: descriptionPrefixBuilder
+ });
+ });
+ }
+
+ /**
* Build a description prefix for a memory:<browser-name>:<process-name>:
* process_count value.
*
« 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