Commit 974d0843 authored by Tao Bai's avatar Tao Bai Committed by Commit Bot

AW: Add Memory.Total.PrivateMemoryFootprint

Bug: 10128236
Change-Id: Ibe238ddd409a00ae256d15e705d2c95dfad67f52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849633
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704830}
parent aabb907b
...@@ -36,7 +36,9 @@ void RecordMemoryMetricsImpl( ...@@ -36,7 +36,9 @@ void RecordMemoryMetricsImpl(
return; return;
} }
uint64_t total_private_footprint_kb = 0;
for (const auto& process_dump : dump->process_dumps()) { for (const auto& process_dump : dump->process_dumps()) {
total_private_footprint_kb += process_dump.os_dump().private_footprint_kb;
switch (process_dump.process_type()) { switch (process_dump.process_type()) {
case memory_instrumentation::mojom::ProcessType::BROWSER: { case memory_instrumentation::mojom::ProcessType::BROWSER: {
MEMORY_METRICS_HISTOGRAM_MB( MEMORY_METRICS_HISTOGRAM_MB(
...@@ -67,6 +69,10 @@ void RecordMemoryMetricsImpl( ...@@ -67,6 +69,10 @@ void RecordMemoryMetricsImpl(
break; break;
} }
} }
if (total_private_footprint_kb) {
MEMORY_METRICS_HISTOGRAM_MB("Memory.Total.PrivateMemoryFootprint",
total_private_footprint_kb / 1024);
}
if (done_callback) if (done_callback)
std::move(done_callback).Run(true); std::move(done_callback).Run(true);
} }
......
...@@ -54,6 +54,9 @@ public class MemoryMetricsLoggerTest { ...@@ -54,6 +54,9 @@ public class MemoryMetricsLoggerTest {
Assert.assertNotEquals(0, Assert.assertNotEquals(0,
RecordHistogram.getHistogramTotalCountForTesting( RecordHistogram.getHistogramTotalCountForTesting(
"Memory.Renderer.PrivateMemoryFootprint")); "Memory.Renderer.PrivateMemoryFootprint"));
Assert.assertNotEquals(0,
RecordHistogram.getHistogramTotalCountForTesting(
"Memory.Total.PrivateMemoryFootprint"));
} }
@Test @Test
...@@ -64,9 +67,13 @@ public class MemoryMetricsLoggerTest { ...@@ -64,9 +67,13 @@ public class MemoryMetricsLoggerTest {
Assert.assertNotEquals(0, Assert.assertNotEquals(0,
RecordHistogram.getHistogramTotalCountForTesting( RecordHistogram.getHistogramTotalCountForTesting(
"Memory.Browser.PrivateMemoryFootprint")); "Memory.Browser.PrivateMemoryFootprint"));
// Verify no renderer record in single process mode.
Assert.assertEquals(0, Assert.assertEquals(0,
RecordHistogram.getHistogramTotalCountForTesting( RecordHistogram.getHistogramTotalCountForTesting(
"Memory.Renderer.PrivateMemoryFootprint")); "Memory.Renderer.PrivateMemoryFootprint"));
Assert.assertNotEquals(0,
RecordHistogram.getHistogramTotalCountForTesting(
"Memory.Total.PrivateMemoryFootprint"));
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment