Commit b56172db authored by Siddhartha's avatar Siddhartha Committed by Commit Bot

MemoryInfra: Add UKM for background dump providers

This cl adds ukm for background memory dump providers. This only adds
the providers approved in the privacy review:
https://docs.google.com/document/d/1mzRM7TzDHo-blauk5nfG34zX_4_amCoshPE1iptoOdQ
UMA for these metrics will be added in next cl.

BUG=730783

Change-Id: Ife23dd28cd443725a7b8a6d74ba532220f4bb46f
Reviewed-on: https://chromium-review.googlesource.com/939904
Commit-Queue: Siddhartha S <ssid@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540745}
parent c88d9972
......@@ -40,7 +40,6 @@ const char* const kDumpProviderWhitelist[] = {
"MemoryCache",
"MojoHandleTable",
"MojoLevelDB",
"OutOfProcessHeapProfilingDumpProvider",
"PartitionAlloc",
"ProcessMemoryMetrics",
"Skia",
......@@ -55,17 +54,36 @@ const char* const kDumpProviderWhitelist[] = {
};
// The names of dump providers whitelisted for summary tracing.
// TODO(ssid): Some dump providers do not create ownership edges on background
// dump. So, the effective size will not be correct.
const char* const kDumpProviderSummaryWhitelist[] = {
"android::ResourceManagerImpl",
"BlinkGC",
"BlinkObjectCounters",
"ClientDiscardableSharedMemoryManager",
"DiscardableSharedMemoryManager",
"gpu::BufferManager",
"gpu::RenderbufferManager",
"gpu::TextureManager",
"HistoryReport",
"IndexedDBBackingStore",
"JavaHeap",
"LevelDB",
"LeveldbValueStore",
"LocalStorage",
"Malloc",
"MemoryCache",
"MojoHandleTable",
"MojoLevelDB",
"PartitionAlloc",
"ProcessMemoryMetrics",
"SharedMemoryTracker",
"Skia",
"Sql",
"URLRequestContext",
"V8Isolate",
"SyncDirectory",
"TabRestoreServiceHelper",
nullptr // End of list marker.
};
......
......@@ -79,6 +79,22 @@ class ProcessMemoryMetricsEmitterFake : public ProcessMemoryMetricsEmitter {
DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterFake);
};
void SetAllocatorDumpMetric(ProcessMemoryDumpPtr& pmd,
const std::string& dump_name,
const std::string& metric_name,
uint64_t value) {
auto it = pmd->chrome_dump->entries_for_allocator_dumps.find(dump_name);
if (it == pmd->chrome_dump->entries_for_allocator_dumps.end()) {
memory_instrumentation::mojom::AllocatorMemDumpPtr amd(
memory_instrumentation::mojom::AllocatorMemDump::New());
amd->numeric_entries.insert(std::make_pair(metric_name, value));
pmd->chrome_dump->entries_for_allocator_dumps.insert(
std::make_pair(dump_name, std::move(amd)));
} else {
it->second->numeric_entries.insert(std::make_pair(metric_name, value));
}
}
OSMemDumpPtr GetFakeOSMemDump(uint32_t resident_set_kb,
uint32_t private_footprint_kb,
#if defined(OS_LINUX) || defined(OS_ANDROID)
......@@ -106,9 +122,8 @@ void PopulateBrowserMetrics(GlobalMemoryDumpPtr& global_dump,
memory_instrumentation::mojom::ProcessMemoryDump::New());
pmd->process_type = ProcessType::BROWSER;
pmd->chrome_dump = memory_instrumentation::mojom::ChromeMemDump::New();
#if !defined(OS_WIN)
pmd->chrome_dump->malloc_total_kb = metrics_mb["Malloc"] * 1024;
#endif
SetAllocatorDumpMetric(pmd, "malloc", "effective_size",
metrics_mb["Malloc"] * 1024 * 1024);
OSMemDumpPtr os_dump =
GetFakeOSMemDump(metrics_mb["Resident"] * 1024,
metrics_mb["PrivateMemoryFootprint"] * 1024,
......@@ -131,9 +146,7 @@ base::flat_map<const char*, int64_t> GetExpectedBrowserMetrics() {
{
{"ProcessType", static_cast<int64_t>(ProcessType::BROWSER)},
{"Resident", 10},
#if !defined(OS_WIN)
{"Malloc", 20},
#endif
{"PrivateMemoryFootprint", 30}, {"SharedMemoryFootprint", 35},
{"Uptime", 42},
#if defined(OS_LINUX) || defined(OS_ANDROID)
......@@ -143,22 +156,6 @@ base::flat_map<const char*, int64_t> GetExpectedBrowserMetrics() {
base::KEEP_FIRST_OF_DUPES);
}
void SetAllocatorDumpMetric(ProcessMemoryDumpPtr& pmd,
const std::string& dump_name,
const std::string& metric_name,
uint64_t value) {
auto it = pmd->chrome_dump->entries_for_allocator_dumps.find(dump_name);
if (it == pmd->chrome_dump->entries_for_allocator_dumps.end()) {
memory_instrumentation::mojom::AllocatorMemDumpPtr amd(
memory_instrumentation::mojom::AllocatorMemDump::New());
amd->numeric_entries.insert(std::make_pair(metric_name, value));
pmd->chrome_dump->entries_for_allocator_dumps.insert(
std::make_pair(dump_name, std::move(amd)));
} else {
it->second->numeric_entries.insert(std::make_pair(metric_name, value));
}
}
void PopulateRendererMetrics(
GlobalMemoryDumpPtr& global_dump,
base::flat_map<const char*, int64_t>& metrics_mb_or_count,
......@@ -167,13 +164,14 @@ void PopulateRendererMetrics(
memory_instrumentation::mojom::ProcessMemoryDump::New());
pmd->process_type = ProcessType::RENDERER;
pmd->chrome_dump = memory_instrumentation::mojom::ChromeMemDump::New();
#if !defined(OS_WIN)
pmd->chrome_dump->malloc_total_kb = metrics_mb_or_count["Malloc"] * 1024;
#endif
pmd->chrome_dump->partition_alloc_total_kb =
metrics_mb_or_count["PartitionAlloc"] * 1024;
pmd->chrome_dump->blink_gc_total_kb = metrics_mb_or_count["BlinkGC"] * 1024;
pmd->chrome_dump->v8_total_kb = metrics_mb_or_count["V8"] * 1024;
SetAllocatorDumpMetric(pmd, "malloc", "effective_size",
metrics_mb_or_count["Malloc"] * 1024 * 1024);
SetAllocatorDumpMetric(pmd, "partition_alloc", "effective_size",
metrics_mb_or_count["PartitionAlloc"] * 1024 * 1024);
SetAllocatorDumpMetric(pmd, "blink_gc", "effective_size",
metrics_mb_or_count["BlinkGC"] * 1024 * 1024);
SetAllocatorDumpMetric(pmd, "v8", "effective_size",
metrics_mb_or_count["V8"] * 1024 * 1024);
SetAllocatorDumpMetric(pmd, "blink_objects/Document", "object_count",
metrics_mb_or_count["NumberOfDocuments"]);
......@@ -183,8 +181,10 @@ void PopulateRendererMetrics(
metrics_mb_or_count["NumberOfLayoutObjects"]);
SetAllocatorDumpMetric(pmd, "blink_objects/Node", "object_count",
metrics_mb_or_count["NumberOfNodes"]);
SetAllocatorDumpMetric(pmd, "partition_alloc/partitions/array_buffer", "size",
metrics_mb_or_count["ArrayBuffer"] * 1024 * 1024);
SetAllocatorDumpMetric(
pmd, "partition_alloc/partitions/array_buffer", "effective_size",
metrics_mb_or_count["PartitionAlloc.Partitions.ArrayBuffer"] * 1024 *
1024);
OSMemDumpPtr os_dump = GetFakeOSMemDump(
metrics_mb_or_count["Resident"] * 1024,
......@@ -208,19 +208,16 @@ base::flat_map<const char*, int64_t> GetExpectedRendererMetrics() {
return base::flat_map<const char*, int64_t>(
{
{"ProcessType", static_cast<int64_t>(ProcessType::RENDERER)},
{"Resident", 110},
#if !defined(OS_WIN)
{"Malloc", 120},
#endif
{"PrivateMemoryFootprint", 130}, {"SharedMemoryFootprint", 135},
{"PartitionAlloc", 140}, {"BlinkGC", 150}, {"V8", 160},
{"NumberOfExtensions", 0}, {"Uptime", 42},
{"Resident", 110}, {"Malloc", 120}, {"PrivateMemoryFootprint", 130},
{"SharedMemoryFootprint", 135}, {"PartitionAlloc", 140},
{"BlinkGC", 150}, {"V8", 160}, {"NumberOfExtensions", 0},
{"Uptime", 42},
#if defined(OS_LINUX) || defined(OS_ANDROID)
{"PrivateSwapFootprint", 50},
#endif
{"NumberOfDocuments", 1}, {"NumberOfFrames", 2},
{"NumberOfLayoutObjects", 5}, {"NumberOfNodes", 3},
{"ArrayBuffer", 10},
{"PartitionAlloc.Partitions.ArrayBuffer", 10},
},
base::KEEP_FIRST_OF_DUPES);
}
......@@ -237,11 +234,10 @@ void PopulateGpuMetrics(GlobalMemoryDumpPtr& global_dump,
memory_instrumentation::mojom::ProcessMemoryDump::New());
pmd->process_type = ProcessType::GPU;
pmd->chrome_dump = memory_instrumentation::mojom::ChromeMemDump::New();
#if !defined(OS_WIN)
pmd->chrome_dump->malloc_total_kb = metrics_mb["Malloc"] * 1024;
#endif
pmd->chrome_dump->command_buffer_total_kb =
metrics_mb["CommandBuffer"] * 1024;
SetAllocatorDumpMetric(pmd, "malloc", "effective_size",
metrics_mb["Malloc"] * 1024 * 1024);
SetAllocatorDumpMetric(pmd, "gpu/gl", "effective_size",
metrics_mb["CommandBuffer"] * 1024 * 1024);
OSMemDumpPtr os_dump =
GetFakeOSMemDump(metrics_mb["Resident"] * 1024,
metrics_mb["PrivateMemoryFootprint"] * 1024,
......@@ -264,9 +260,7 @@ base::flat_map<const char*, int64_t> GetExpectedGpuMetrics() {
{
{"ProcessType", static_cast<int64_t>(ProcessType::GPU)},
{"Resident", 210},
#if !defined(OS_WIN)
{"Malloc", 220},
#endif
{"PrivateMemoryFootprint", 230}, {"SharedMemoryFootprint", 235},
{"CommandBuffer", 240}, {"Uptime", 42},
#if defined(OS_LINUX) || defined(OS_ANDROID)
......
......@@ -1420,6 +1420,7 @@ be describing additional metrics about the same event.
<event name="Memory.Experimental">
<owner>erikchen@chromium.org</owner>
<owner>ssid@chromium.org</owner>
<summary>
Metrics associated with memory consumption, in MB.
</summary>
......@@ -1433,20 +1434,61 @@ be describing additional metrics about the same event.
Measure of memory consumed by Oilpan.
</summary>
</metric>
<metric name="BlinkGC.AllocatedObjects">
<summary>
Measure of memory consumed by live allocations made from Oilpan.
</summary>
</metric>
<metric name="CommandBuffer">
<summary>
Measure of memory consumed by GL command buffer.
</summary>
</metric>
<metric name="Discardable">
<summary>
Measure of memory consumed by Discardable memory service.
</summary>
</metric>
<metric name="Extensions.ValueStore">
<summary>
Measure of memory consumed by Key Value Store databases of extensions.
</summary>
</metric>
<metric name="History">
<summary>
Approximate measure of memory consumed by History service.
</summary>
</metric>
<metric name="IsVisible">
<summary>
Indicates whether the tab is visible or not at the time of metric
collection.
</summary>
</metric>
<metric name="JavaHeap">
<summary>
Measure of memory consumed by java heap on Android.
</summary>
</metric>
<metric name="LevelDatabase">
<summary>
Measure of memory consumed by unaccounted level databases.
</summary>
</metric>
<metric name="Malloc">
<summary>
Measure of memory allocated by malloc.
Measure of memory allocated by malloc, that is not classified by other
metrics.
</summary>
</metric>
<metric name="Net">
<summary>
Measure of memory allocated by network sockets and caches.
</summary>
</metric>
<metric name="Net.UrlRequestContext">
<summary>
Measure of memory allocated by all network requests.
</summary>
</metric>
<metric name="NumberOfDocuments">
......@@ -1470,6 +1512,11 @@ be describing additional metrics about the same event.
The number of layout objects that the associated renderer owns.
</summary>
</metric>
<metric name="NumberOfMojoHandles">
<summary>
The number of mojo handles stored in HandleTable.
</summary>
</metric>
<metric name="NumberOfNodes">
<summary>
The number of nodes that the associated renderer owns.
......@@ -1477,7 +1524,32 @@ be describing additional metrics about the same event.
</metric>
<metric name="PartitionAlloc">
<summary>
Measure of memory allocated by PartitionAlloc.
Measure of memory allocated by PartitionAlloc allocator.
</summary>
</metric>
<metric name="PartitionAlloc.AllocatedObjects">
<summary>
Measure of total memory used by objects allocated using PartitionAlloc.
</summary>
</metric>
<metric name="PartitionAlloc.Partitions.ArrayBuffer">
<summary>
Measure of memory used by Array Buffer partition in PartitionAlloc.
</summary>
</metric>
<metric name="PartitionAlloc.Partitions.Buffer">
<summary>
Measure of memory used by Buffer partition in PartitionAlloc.
</summary>
</metric>
<metric name="PartitionAlloc.Partitions.FastMalloc">
<summary>
Measure of memory used by Fast Malloc partition in PartitionAlloc.
</summary>
</metric>
<metric name="PartitionAlloc.Partitions.Layout">
<summary>
Measure of memory used by Layout partition in PartitionAlloc.
</summary>
</metric>
<metric name="PrivateMemoryFootprint">
......@@ -1508,6 +1580,56 @@ be describing additional metrics about the same event.
Measure of total shared memory consumed by process.
</summary>
</metric>
<metric name="SiteStorage">
<summary>
Measure of memory used due to web storage APIs in browser process.
</summary>
</metric>
<metric name="SiteStorage.IndexDB">
<summary>
Measure of memory used due to IndexedDB API in browser process.
</summary>
</metric>
<metric name="SiteStorage.LocalStorage">
<summary>
Measure of memory used due to Local Storage API in browser process.
</summary>
</metric>
<metric name="SiteStorage.SessionStorage">
<summary>
Measure of memory used due to Session Storage API in browser process.
</summary>
</metric>
<metric name="Skia">
<summary>
Measure of memory used by Skia.
</summary>
</metric>
<metric name="Skia.SkGlyphCache">
<summary>
Measure of memory used by Skia Glyph Cache.
</summary>
</metric>
<metric name="Skia.SkResourceCache">
<summary>
Measure of memory used by Skia Resource Cache.
</summary>
</metric>
<metric name="Sqlite">
<summary>
Measure of memory used by all sqlite databases.
</summary>
</metric>
<metric name="Sync">
<summary>
Measure of memory used by Sync storage.
</summary>
</metric>
<metric name="TabRestore">
<summary>
Approximate measure of memory used by Tab restore service.
</summary>
</metric>
<metric name="TimeSinceLastNavigation">
<summary>
The time in seconds since the Tab navigated. Only emitted for tabs that
......@@ -1530,6 +1652,11 @@ be describing additional metrics about the same event.
Measure of total shared memory consumed by all processes.
</summary>
</metric>
<metric name="UI">
<summary>
Measure of memory used by Android UI bitmaps.
</summary>
</metric>
<metric name="Uptime">
<summary>
Process uptime.
......@@ -1540,6 +1667,41 @@ be describing additional metrics about the same event.
Measure of memory consumed by V8.
</summary>
</metric>
<metric name="WebCache">
<summary>
Measure of memory consumed by all resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.CSSStylesheetResources">
<summary>
Measure of memory consumed by CSS Stylesheet resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.FontResources">
<summary>
Measure of memory consumed by Font resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.ImageResources">
<summary>
Measure of memory consumed by Image resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.OtherResources">
<summary>
Measure of memory consumed by other resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.ScriptResources">
<summary>
Measure of memory consumed by Script resources in Blink Web Cache.
</summary>
</metric>
<metric name="WebCache.XSLStylesheetResources">
<summary>
Measure of memory consumed by XSL Stylesheet resources in Blink Web Cache.
</summary>
</metric>
</event>
<event name="OfflinePages.SavePageRequested">
......
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