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 3000abbdb5770d4121e7961319805438368ce6cf..ee7eda13e0b7c2f5d05b1aa1fdba571de5a119c1 100644 |
--- a/tracing/tracing/metrics/system_health/memory_metric.html |
+++ b/tracing/tracing/metrics/system_health/memory_metric.html |
@@ -1089,7 +1089,7 @@ tr.exportTo('tr.metrics.sh', function() { |
* (corresponding to global memory dumps associated with the given browser) |
* |values| for each process (e.g. 'gpu_process', 'browser_process', etc). |
* We also report a special 'all_processes' histogram which agregates all |
- * others, this has a RelatedHistogramBreakdown diagnostic explaining |
+ * others, this has a RelatedNameMap diagnostic explaining |
* how it is built from the other histograms. |
* |
* See addMemoryDumpValues for more details. |
@@ -1121,32 +1121,30 @@ tr.exportTo('tr.metrics.sh', function() { |
} |
cachedHistograms.set(histogram.name, histogram); |
- const processBreakdown = new tr.v.d.RelatedHistogramBreakdown(); |
- processBreakdown.colorScheme = |
- tr.e.chrome.chrome_processes.PROCESS_COLOR_SCHEME_NAME; |
+ const processNames = new tr.v.d.RelatedNameMap(); |
for (const [childProcessName, childProcessNode] of tree.children[0]) { |
processPath.push(childProcessName); |
const childProcessHistogram = |
recurse(processPath, componentPath, childProcessNode); |
- processBreakdown.set(childProcessName, childProcessHistogram); |
+ processNames.set(childProcessName, childProcessHistogram.name); |
processPath.pop(); |
} |
- const componentBreakdown = new tr.v.d.RelatedHistogramBreakdown(); |
+ const componentNames = new tr.v.d.RelatedNameMap(); |
for (const [childComponentName, childComponentNode] of tree.children[1]) { |
componentPath.push(childComponentName); |
const childComponentHistogram = |
recurse(processPath, componentPath, childComponentNode); |
- componentBreakdown.set(childComponentName, childComponentHistogram); |
+ componentNames.set(childComponentName, childComponentHistogram.name); |
componentPath.pop(); |
} |
values.addHistogram(histogram); |
if (tree.children[0].size > 0) { |
- histogram.diagnostics.set('processes', processBreakdown); |
+ histogram.diagnostics.set('processes', processNames); |
} |
if (tree.children[1].size > 0) { |
- histogram.diagnostics.set('components', componentBreakdown); |
+ histogram.diagnostics.set('components', componentNames); |
} |
return histogram; |
@@ -1198,6 +1196,33 @@ tr.exportTo('tr.metrics.sh', function() { |
return numeric; |
} |
+ function buildSampleDiagnostics(value, node) { |
+ if (node.children.length < 2) return undefined; |
+ const diagnostics = new Map(); |
+ const i = node.values.indexOf(value); |
+ |
+ const processBreakdown = new tr.v.d.Breakdown(); |
+ processBreakdown.colorScheme = |
+ tr.e.chrome.chrome_processes.PROCESS_COLOR_SCHEME_NAME; |
+ for (const [name, subNode] of node.children[0]) { |
+ processBreakdown.set(name, subNode.values[i].total); |
+ } |
+ if (processBreakdown.size > 0) { |
+ diagnostics.set('processes', processBreakdown); |
+ } |
+ |
+ const componentBreakdown = new tr.v.d.Breakdown(); |
+ for (const [name, subNode] of node.children[1]) { |
+ componentBreakdown.set(name, subNode.values[i].total); |
+ } |
+ if (componentBreakdown.size > 0) { |
+ diagnostics.set('components', componentBreakdown); |
+ } |
+ |
+ if (diagnostics.size === 0) return undefined; |
+ return diagnostics; |
+ } |
+ |
/** |
* Create a memory tr.v.Histogram with |unit| and add all total values in |
* |node| to it. |
@@ -1205,7 +1230,10 @@ tr.exportTo('tr.metrics.sh', function() { |
function buildMemoryNumericFromNode(name, node, unit) { |
const histogram = new tr.v.Histogram( |
name, unit, BOUNDARIES_FOR_UNIT_MAP.get(unit)); |
- node.values.forEach(v => histogram.addSample(v.total)); |
+ |
+ node.values.forEach(v => histogram.addSample( |
+ v.total, buildSampleDiagnostics(v, node))); |
+ |
return histogram; |
} |