Commit 127ff385 authored by Sasha McIntosh's avatar Sasha McIntosh Committed by Commit Bot

Emit small memory metrics in the 1KB - 500MB range

Allow individual buckets for recording the 1-10KB range of small memory
metrics. For some metrics like
Memory.Experimental.Gpu2.Small.ServiceDiscardableManager the 0-10KB
bucket captures 88% of samples.

This change affects all Memory.Experimental.*.Small.* metrics.

Change-Id: I47faf6060f82642ea20438e57e9563d01e6e949e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940450Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Sasha McIntosh <sashamcintosh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#725988}
parent 9b62ea0f
...@@ -52,7 +52,12 @@ namespace { ...@@ -52,7 +52,12 @@ namespace {
const char kEffectiveSize[] = "effective_size"; const char kEffectiveSize[] = "effective_size";
const char kSize[] = "size"; const char kSize[] = "size";
const char kAllocatedObjectsSize[] = "allocated_objects_size"; const char kAllocatedObjectsSize[] = "allocated_objects_size";
const bool kLargeMetric = true;
enum class MetricSize {
kLarge, // 1MB - 64GB
kSmall, // 10KB - 500MB
kTiny, // 1B - 500KB
};
enum class EmitTo { enum class EmitTo {
kCountsInUkmOnly, kCountsInUkmOnly,
...@@ -66,9 +71,9 @@ struct Metric { ...@@ -66,9 +71,9 @@ struct Metric {
const char* const dump_name; const char* const dump_name;
// The name of the metric to be recorded in UMA. // The name of the metric to be recorded in UMA.
const char* const uma_name; const char* const uma_name;
// Should the UMA use large memory range (1MB - 64GB) or small memory range // Indicates the size range of the metric. Only relevant if the |metric| is a
// (10KB - 500MB). Only relevant if the |metric| is a size metric. // size metric.
const bool is_large_metric; const MetricSize metric_size;
// The type of metric that is measured, usually size in bytes or object count. // The type of metric that is measured, usually size in bytes or object count.
const char* const metric; const char* const metric;
// Indicates where to emit the metric. // Indicates where to emit the metric.
...@@ -78,269 +83,271 @@ struct Metric { ...@@ -78,269 +83,271 @@ struct Metric {
}; };
const Metric kAllocatorDumpNamesForMetrics[] = { const Metric kAllocatorDumpNamesForMetrics[] = {
{"blink_gc", "BlinkGC", kLargeMetric, kEffectiveSize, {"blink_gc", "BlinkGC", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetBlinkGC}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetBlinkGC},
{"blink_gc", "BlinkGC.AllocatedObjects", kLargeMetric, {"blink_gc", "BlinkGC.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetBlinkGC_AllocatedObjects}, &Memory_Experimental::SetBlinkGC_AllocatedObjects},
{"blink_objects/Document", "NumberOfDocuments", !kLargeMetric, {"blink_objects/Document", "NumberOfDocuments", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfDocuments}, &Memory_Experimental::SetNumberOfDocuments},
{"blink_objects/AdSubframe", "NumberOfAdSubframes", !kLargeMetric, {"blink_objects/AdSubframe", "NumberOfAdSubframes", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfAdSubframes}, &Memory_Experimental::SetNumberOfAdSubframes},
{"blink_objects/DetachedScriptState", "NumberOfDetachedScriptStates", {"blink_objects/DetachedScriptState", "NumberOfDetachedScriptStates",
!kLargeMetric, MemoryAllocatorDump::kNameObjectCount, MetricSize::kSmall, MemoryAllocatorDump::kNameObjectCount,
EmitTo::kCountsInUkmOnly, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfDetachedScriptStates}, &Memory_Experimental::SetNumberOfDetachedScriptStates},
{"blink_objects/V8CallInDetachedWindowByNavigation", {"blink_objects/V8CallInDetachedWindowByNavigation",
"NumberOfCallsInDetachedWindowByNavigation", !kLargeMetric, "NumberOfCallsInDetachedWindowByNavigation", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfCallsInDetachedWindowByNavigation}, &Memory_Experimental::SetNumberOfCallsInDetachedWindowByNavigation},
{"blink_objects/V8CallInDetachedWindowByNavigationAfter10s", {"blink_objects/V8CallInDetachedWindowByNavigationAfter10s",
"NumberOfCallsInDetachedWindowByNavigationAfter10s", !kLargeMetric, "NumberOfCallsInDetachedWindowByNavigationAfter10s", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByNavigation_After10sSinceDetaching}, SetNumberOfCallsInDetachedWindowByNavigation_After10sSinceDetaching},
{"blink_objects/V8CallInDetachedWindowByNavigationAfter1min", {"blink_objects/V8CallInDetachedWindowByNavigationAfter1min",
"NumberOfCallsInDetachedWindowByNavigationAfter1min", !kLargeMetric, "NumberOfCallsInDetachedWindowByNavigationAfter1min", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByNavigation_After1minSinceDetaching}, SetNumberOfCallsInDetachedWindowByNavigation_After1minSinceDetaching},
{"blink_objects/V8CallInDetachedWindowByClosing", {"blink_objects/V8CallInDetachedWindowByClosing",
"NumberOfCallsInDetachedWindowByClosing", !kLargeMetric, "NumberOfCallsInDetachedWindowByClosing", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfCallsInDetachedWindowByClosing}, &Memory_Experimental::SetNumberOfCallsInDetachedWindowByClosing},
{"blink_objects/V8CallInDetachedWindowByClosingAfter10s", {"blink_objects/V8CallInDetachedWindowByClosingAfter10s",
"NumberOfCallsInDetachedWindowByClosingAfter10s", !kLargeMetric, "NumberOfCallsInDetachedWindowByClosingAfter10s", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByClosing_After10sSinceDetaching}, SetNumberOfCallsInDetachedWindowByClosing_After10sSinceDetaching},
{"blink_objects/V8CallInDetachedWindowByClosingAfter1min", {"blink_objects/V8CallInDetachedWindowByClosingAfter1min",
"NumberOfCallsInDetachedWindowByClosingAfter1min", !kLargeMetric, "NumberOfCallsInDetachedWindowByClosingAfter1min", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByClosing_After1minSinceDetaching}, SetNumberOfCallsInDetachedWindowByClosing_After1minSinceDetaching},
{"blink_objects/V8CallInDetachedWindowByOtherReason", {"blink_objects/V8CallInDetachedWindowByOtherReason",
"NumberOfCallsInDetachedWindowByOtherReason", !kLargeMetric, "NumberOfCallsInDetachedWindowByOtherReason", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfCallsInDetachedWindowByOtherReason}, &Memory_Experimental::SetNumberOfCallsInDetachedWindowByOtherReason},
{"blink_objects/V8CallInDetachedWindowByOtherReasonAfter10s", {"blink_objects/V8CallInDetachedWindowByOtherReasonAfter10s",
"NumberOfCallsInDetachedWindowByOtherReasonAfter10s", !kLargeMetric, "NumberOfCallsInDetachedWindowByOtherReasonAfter10s", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByOtherReason_After10sSinceDetaching}, SetNumberOfCallsInDetachedWindowByOtherReason_After10sSinceDetaching},
{"blink_objects/V8CallInDetachedWindowByOtherReasonAfter1min", {"blink_objects/V8CallInDetachedWindowByOtherReasonAfter1min",
"NumberOfCallsInDetachedWindowByOtherReasonAfter1min", !kLargeMetric, "NumberOfCallsInDetachedWindowByOtherReasonAfter1min", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental:: &Memory_Experimental::
SetNumberOfCallsInDetachedWindowByOtherReason_After1minSinceDetaching}, SetNumberOfCallsInDetachedWindowByOtherReason_After1minSinceDetaching},
{"blink_objects/Frame", "NumberOfFrames", !kLargeMetric, {"blink_objects/Frame", "NumberOfFrames", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfFrames}, &Memory_Experimental::SetNumberOfFrames},
{"blink_objects/LayoutObject", "NumberOfLayoutObjects", !kLargeMetric, {"blink_objects/LayoutObject", "NumberOfLayoutObjects", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfLayoutObjects}, &Memory_Experimental::SetNumberOfLayoutObjects},
{"blink_objects/Node", "NumberOfNodes", !kLargeMetric, {"blink_objects/Node", "NumberOfNodes", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfNodes}, &Memory_Experimental::SetNumberOfNodes},
{"components/download", "DownloadService", !kLargeMetric, kEffectiveSize, {"components/download", "DownloadService", MetricSize::kSmall,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetDownloadService}, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
{"discardable", "Discardable", kLargeMetric, kEffectiveSize, &Memory_Experimental::SetDownloadService},
{"discardable", "Discardable", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetDiscardable}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetDiscardable},
{"extensions/value_store", "Extensions.ValueStore", kLargeMetric, {"extensions/value_store", "Extensions.ValueStore", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetExtensions_ValueStore}, &Memory_Experimental::SetExtensions_ValueStore},
{"font_caches", "FontCaches", !kLargeMetric, kEffectiveSize, {"font_caches", "FontCaches", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetFontCaches}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetFontCaches},
{"gpu/discardable_cache", "ServiceDiscardableManager", !kLargeMetric, kSize, {"gpu/discardable_cache", "ServiceDiscardableManager", MetricSize::kTiny,
EmitTo::kSizeInUmaOnly, nullptr}, kSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/discardable_cache", "ServiceDiscardableManager.AvgImageSize", {"gpu/discardable_cache", "ServiceDiscardableManager.AvgImageSize",
!kLargeMetric, "average_size", EmitTo::kSizeInUmaOnly, nullptr}, MetricSize::kTiny, "average_size", EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/gl", "CommandBuffer", kLargeMetric, kEffectiveSize, {"gpu/gl", "CommandBuffer", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetCommandBuffer}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetCommandBuffer},
{"gpu/gr_shader_cache", "Gpu.GrShaderCache", !kLargeMetric, kEffectiveSize, {"gpu/gr_shader_cache", "Gpu.GrShaderCache", MetricSize::kSmall,
EmitTo::kSizeInUmaOnly, nullptr}, kEffectiveSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/shared_images", "gpu::SharedImageStub", !kLargeMetric, kEffectiveSize, {"gpu/shared_images", "gpu::SharedImageStub", MetricSize::kSmall,
EmitTo::kIgnored, nullptr}, kEffectiveSize, EmitTo::kIgnored, nullptr},
{"gpu/transfer_cache", "ServiceTransferCache", !kLargeMetric, kSize, {"gpu/transfer_cache", "ServiceTransferCache", MetricSize::kTiny, kSize,
EmitTo::kSizeInUmaOnly, nullptr}, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/transfer_cache", "ServiceTransferCache.AvgImageSize", !kLargeMetric, {"gpu/transfer_cache", "ServiceTransferCache.AvgImageSize",
"average_size", EmitTo::kSizeInUmaOnly, nullptr}, MetricSize::kTiny, "average_size", EmitTo::kSizeInUmaOnly, nullptr},
{"history", "History", !kLargeMetric, kEffectiveSize, {"history", "History", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetHistory}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetHistory},
{"java_heap", "JavaHeap", kLargeMetric, kEffectiveSize, {"java_heap", "JavaHeap", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetJavaHeap}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetJavaHeap},
{"leveldatabase", "LevelDatabase", !kLargeMetric, kEffectiveSize, {"leveldatabase", "LevelDatabase", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetLevelDatabase}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetLevelDatabase},
{"malloc", "Malloc", kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"malloc", "Malloc", MetricSize::kLarge, kEffectiveSize,
&Memory_Experimental::SetMalloc}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetMalloc},
{"malloc/allocated_objects", "Malloc.AllocatedObjects", kLargeMetric, {"malloc/allocated_objects", "Malloc.AllocatedObjects", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetMalloc_AllocatedObjects}, &Memory_Experimental::SetMalloc_AllocatedObjects},
{"mojo", "NumberOfMojoHandles", !kLargeMetric, {"mojo", "NumberOfMojoHandles", MetricSize::kSmall,
MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly, MemoryAllocatorDump::kNameObjectCount, EmitTo::kCountsInUkmOnly,
&Memory_Experimental::SetNumberOfMojoHandles}, &Memory_Experimental::SetNumberOfMojoHandles},
{"net", "Net", !kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"net", "Net", MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetNet}, &Memory_Experimental::SetNet},
{"net/url_request_context", "Net.UrlRequestContext", !kLargeMetric, {"net/url_request_context", "Net.UrlRequestContext", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetNet_UrlRequestContext}, &Memory_Experimental::SetNet_UrlRequestContext},
{"omnibox", "OmniboxSuggestions", !kLargeMetric, kEffectiveSize, {"omnibox", "OmniboxSuggestions", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetOmniboxSuggestions}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetOmniboxSuggestions},
{"partition_alloc", "PartitionAlloc", kLargeMetric, kEffectiveSize, {"partition_alloc", "PartitionAlloc", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetPartitionAlloc}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetPartitionAlloc},
{"partition_alloc/allocated_objects", "PartitionAlloc.AllocatedObjects", {"partition_alloc/allocated_objects", "PartitionAlloc.AllocatedObjects",
kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetPartitionAlloc_AllocatedObjects}, &Memory_Experimental::SetPartitionAlloc_AllocatedObjects},
{"partition_alloc/partitions/array_buffer", {"partition_alloc/partitions/array_buffer",
"PartitionAlloc.Partitions.ArrayBuffer", kLargeMetric, kSize, "PartitionAlloc.Partitions.ArrayBuffer", MetricSize::kLarge, kSize,
EmitTo::kSizeInUkmAndUma, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetPartitionAlloc_Partitions_ArrayBuffer}, &Memory_Experimental::SetPartitionAlloc_Partitions_ArrayBuffer},
{"partition_alloc/partitions/buffer", "PartitionAlloc.Partitions.Buffer", {"partition_alloc/partitions/buffer", "PartitionAlloc.Partitions.Buffer",
kLargeMetric, kSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetPartitionAlloc_Partitions_Buffer}, &Memory_Experimental::SetPartitionAlloc_Partitions_Buffer},
{"partition_alloc/partitions/fast_malloc", {"partition_alloc/partitions/fast_malloc",
"PartitionAlloc.Partitions.FastMalloc", kLargeMetric, kSize, "PartitionAlloc.Partitions.FastMalloc", MetricSize::kLarge, kSize,
EmitTo::kSizeInUkmAndUma, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetPartitionAlloc_Partitions_FastMalloc}, &Memory_Experimental::SetPartitionAlloc_Partitions_FastMalloc},
{"partition_alloc/partitions/layout", "PartitionAlloc.Partitions.Layout", {"partition_alloc/partitions/layout", "PartitionAlloc.Partitions.Layout",
kLargeMetric, kSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetPartitionAlloc_Partitions_Layout}, &Memory_Experimental::SetPartitionAlloc_Partitions_Layout},
{"site_storage", "SiteStorage", kLargeMetric, kEffectiveSize, {"site_storage", "SiteStorage", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSiteStorage}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSiteStorage},
{"site_storage/blob_storage", "SiteStorage.BlobStorage", kLargeMetric, {"site_storage/blob_storage", "SiteStorage.BlobStorage", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetSiteStorage_BlobStorage}, &Memory_Experimental::SetSiteStorage_BlobStorage},
{"site_storage/index_db", "SiteStorage.IndexDB", !kLargeMetric, {"site_storage/index_db", "SiteStorage.IndexDB", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetSiteStorage_IndexDB}, &Memory_Experimental::SetSiteStorage_IndexDB},
{"site_storage/localstorage", "SiteStorage.LocalStorage", !kLargeMetric, {"site_storage/localstorage", "SiteStorage.LocalStorage",
kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetSiteStorage_LocalStorage}, &Memory_Experimental::SetSiteStorage_LocalStorage},
{"site_storage/session_storage", "SiteStorage.SessionStorage", {"site_storage/session_storage", "SiteStorage.SessionStorage",
!kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetSiteStorage_SessionStorage}, &Memory_Experimental::SetSiteStorage_SessionStorage},
{"skia", "Skia", kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"skia", "Skia", MetricSize::kLarge, kEffectiveSize,
&Memory_Experimental::SetSkia}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSkia},
{"skia/gpu_resources", "SharedContextState", kLargeMetric, kEffectiveSize, {"skia/gpu_resources", "SharedContextState", MetricSize::kLarge,
EmitTo::kIgnored, nullptr}, kEffectiveSize, EmitTo::kIgnored, nullptr},
{"skia/gpu_resources", "VizProcessContextProvider", kLargeMetric, {"skia/gpu_resources", "VizProcessContextProvider", MetricSize::kLarge,
kEffectiveSize, EmitTo::kIgnored, nullptr}, kEffectiveSize, EmitTo::kIgnored, nullptr},
{"skia/sk_glyph_cache", "Skia.SkGlyphCache", kLargeMetric, kEffectiveSize, {"skia/sk_glyph_cache", "Skia.SkGlyphCache", MetricSize::kLarge,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSkia_SkGlyphCache}, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
{"skia/sk_resource_cache", "Skia.SkResourceCache", kLargeMetric, &Memory_Experimental::SetSkia_SkGlyphCache},
{"skia/sk_resource_cache", "Skia.SkResourceCache", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetSkia_SkResourceCache}, &Memory_Experimental::SetSkia_SkResourceCache},
{"sqlite", "Sqlite", !kLargeMetric, kEffectiveSize, {"sqlite", "Sqlite", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSqlite}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSqlite},
{"sync", "Sync", kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"sync", "Sync", MetricSize::kLarge, kEffectiveSize,
&Memory_Experimental::SetSync}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetSync},
{"tab_restore", "TabRestore", !kLargeMetric, kEffectiveSize, {"tab_restore", "TabRestore", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetTabRestore}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetTabRestore},
{"ui", "UI", !kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"ui", "UI", MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetUI}, &Memory_Experimental::SetUI},
{"v8", "V8", kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, {"v8", "V8", MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8}, &Memory_Experimental::SetV8},
{"v8", "V8.AllocatedObjects", kLargeMetric, kAllocatedObjectsSize, {"v8", "V8.AllocatedObjects", MetricSize::kLarge, kAllocatedObjectsSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_AllocatedObjects}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_AllocatedObjects},
{"v8/main", "V8.Main", kLargeMetric, kEffectiveSize, {"v8/main", "V8.Main", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main},
{"v8/main", "V8.Main.AllocatedObjects", kLargeMetric, kAllocatedObjectsSize, {"v8/main", "V8.Main.AllocatedObjects", MetricSize::kLarge,
EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_AllocatedObjects}, &Memory_Experimental::SetV8_Main_AllocatedObjects},
{"v8/main/heap", "V8.Main.Heap", kLargeMetric, kEffectiveSize, {"v8/main/heap", "V8.Main.Heap", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main_Heap}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main_Heap},
{"v8/main/heap", "V8.Main.Heap.AllocatedObjects", kLargeMetric, {"v8/main/heap", "V8.Main.Heap.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_AllocatedObjects},
{"v8/main/heap/code_large_object_space", {"v8/main/heap/code_large_object_space",
"V8.Main.Heap.CodeLargeObjectSpace", kLargeMetric, kEffectiveSize, "V8.Main.Heap.CodeLargeObjectSpace", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_CodeLargeObjectSpace}, &Memory_Experimental::SetV8_Main_Heap_CodeLargeObjectSpace},
{"v8/main/heap/code_large_object_space", {"v8/main/heap/code_large_object_space",
"V8.Main.Heap.CodeLargeObjectSpace.AllocatedObjects", kLargeMetric, "V8.Main.Heap.CodeLargeObjectSpace.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental:: &Memory_Experimental::
SetV8_Main_Heap_CodeLargeObjectSpace_AllocatedObjects}, SetV8_Main_Heap_CodeLargeObjectSpace_AllocatedObjects},
{"v8/main/heap/code_space", "V8.Main.Heap.CodeSpace", kLargeMetric, {"v8/main/heap/code_space", "V8.Main.Heap.CodeSpace", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_CodeSpace}, &Memory_Experimental::SetV8_Main_Heap_CodeSpace},
{"v8/main/heap/code_space", "V8.Main.Heap.CodeSpace.AllocatedObjects", {"v8/main/heap/code_space", "V8.Main.Heap.CodeSpace.AllocatedObjects",
kLargeMetric, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_CodeSpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_CodeSpace_AllocatedObjects},
{"v8/main/heap/large_object_space", "V8.Main.Heap.LargeObjectSpace", {"v8/main/heap/large_object_space", "V8.Main.Heap.LargeObjectSpace",
kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_LargeObjectSpace}, &Memory_Experimental::SetV8_Main_Heap_LargeObjectSpace},
{"v8/main/heap/large_object_space", {"v8/main/heap/large_object_space",
"V8.Main.Heap.LargeObjectSpace.AllocatedObjects", kLargeMetric, "V8.Main.Heap.LargeObjectSpace.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_LargeObjectSpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_LargeObjectSpace_AllocatedObjects},
{"v8/main/heap/map_space", "V8.Main.Heap.MapSpace", kLargeMetric, {"v8/main/heap/map_space", "V8.Main.Heap.MapSpace", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_MapSpace}, &Memory_Experimental::SetV8_Main_Heap_MapSpace},
{"v8/main/heap/map_space", "V8.Main.Heap.MapSpace.AllocatedObjects", {"v8/main/heap/map_space", "V8.Main.Heap.MapSpace.AllocatedObjects",
kLargeMetric, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_MapSpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_MapSpace_AllocatedObjects},
{"v8/main/heap/new_large_object_space", "V8.Main.Heap.NewLargeObjectSpace", {"v8/main/heap/new_large_object_space", "V8.Main.Heap.NewLargeObjectSpace",
kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_NewLargeObjectSpace}, &Memory_Experimental::SetV8_Main_Heap_NewLargeObjectSpace},
{"v8/main/heap/new_large_object_space", {"v8/main/heap/new_large_object_space",
"V8.Main.Heap.NewLargeObjectSpace.AllocatedObjects", kLargeMetric, "V8.Main.Heap.NewLargeObjectSpace.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental:: &Memory_Experimental::
SetV8_Main_Heap_NewLargeObjectSpace_AllocatedObjects}, SetV8_Main_Heap_NewLargeObjectSpace_AllocatedObjects},
{"v8/main/heap/new_space", "V8.Main.Heap.NewSpace", kLargeMetric, {"v8/main/heap/new_space", "V8.Main.Heap.NewSpace", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_NewSpace}, &Memory_Experimental::SetV8_Main_Heap_NewSpace},
{"v8/main/heap/new_space", "V8.Main.Heap.NewSpace.AllocatedObjects", {"v8/main/heap/new_space", "V8.Main.Heap.NewSpace.AllocatedObjects",
kLargeMetric, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_NewSpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_NewSpace_AllocatedObjects},
{"v8/main/heap/old_space", "V8.Main.Heap.OldSpace", kLargeMetric, {"v8/main/heap/old_space", "V8.Main.Heap.OldSpace", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_OldSpace}, &Memory_Experimental::SetV8_Main_Heap_OldSpace},
{"v8/main/heap/old_space", "V8.Main.Heap.OldSpace.AllocatedObjects", {"v8/main/heap/old_space", "V8.Main.Heap.OldSpace.AllocatedObjects",
kLargeMetric, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_OldSpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_OldSpace_AllocatedObjects},
{"v8/main/heap/read_only_space", "V8.Main.Heap.ReadOnlySpace", kLargeMetric, {"v8/main/heap/read_only_space", "V8.Main.Heap.ReadOnlySpace",
kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_ReadOnlySpace}, &Memory_Experimental::SetV8_Main_Heap_ReadOnlySpace},
{"v8/main/heap/read_only_space", {"v8/main/heap/read_only_space",
"V8.Main.Heap.ReadOnlySpace.AllocatedObjects", kLargeMetric, "V8.Main.Heap.ReadOnlySpace.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_Heap_ReadOnlySpace_AllocatedObjects}, &Memory_Experimental::SetV8_Main_Heap_ReadOnlySpace_AllocatedObjects},
{"v8/main/malloc", "V8.Main.Malloc", kLargeMetric, kEffectiveSize, {"v8/main/malloc", "V8.Main.Malloc", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main_Malloc}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main_Malloc},
{"v8/workers", "V8.Workers", kLargeMetric, kEffectiveSize, {"v8/workers", "V8.Workers", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Workers}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Workers},
{"v8/workers", "V8.Workers.AllocatedObjects", kLargeMetric, {"v8/workers", "V8.Workers.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Workers_AllocatedObjects}, &Memory_Experimental::SetV8_Workers_AllocatedObjects},
{"web_cache", "WebCache", !kLargeMetric, kEffectiveSize, {"web_cache", "WebCache", MetricSize::kSmall, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetWebCache}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetWebCache},
{"web_cache/Image_resources", "WebCache.ImageResources", !kLargeMetric, {"web_cache/Image_resources", "WebCache.ImageResources", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_ImageResources}, &Memory_Experimental::SetWebCache_ImageResources},
{"web_cache/CSS stylesheet_resources", "WebCache.CSSStylesheetResources", {"web_cache/CSS stylesheet_resources", "WebCache.CSSStylesheetResources",
!kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_CSSStylesheetResources}, &Memory_Experimental::SetWebCache_CSSStylesheetResources},
{"web_cache/Script_resources", "WebCache.ScriptResources", !kLargeMetric, {"web_cache/Script_resources", "WebCache.ScriptResources",
kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_ScriptResources}, &Memory_Experimental::SetWebCache_ScriptResources},
{"web_cache/XSL stylesheet_resources", "WebCache.XSLStylesheetResources", {"web_cache/XSL stylesheet_resources", "WebCache.XSLStylesheetResources",
!kLargeMetric, kEffectiveSize, EmitTo::kSizeInUkmAndUma, MetricSize::kSmall, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_XSLStylesheetResources}, &Memory_Experimental::SetWebCache_XSLStylesheetResources},
{"web_cache/Font_resources", "WebCache.FontResources", !kLargeMetric, {"web_cache/Font_resources", "WebCache.FontResources", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_FontResources}, &Memory_Experimental::SetWebCache_FontResources},
{"web_cache/Code_cache", "WebCache.V8CodeCache", !kLargeMetric, {"web_cache/Code_cache", "WebCache.V8CodeCache", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_V8CodeCache}, &Memory_Experimental::SetWebCache_V8CodeCache},
{"web_cache/Encoded_size_duplicated_in_data_urls", {"web_cache/Encoded_size_duplicated_in_data_urls",
"WebCache.EncodedSizeDuplicatedInDataUrls", !kLargeMetric, kEffectiveSize, "WebCache.EncodedSizeDuplicatedInDataUrls", MetricSize::kSmall,
EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_EncodedSizeDuplicatedInDataUrls}, &Memory_Experimental::SetWebCache_EncodedSizeDuplicatedInDataUrls},
{"web_cache/Other_resources", "WebCache.OtherResources", !kLargeMetric, {"web_cache/Other_resources", "WebCache.OtherResources", MetricSize::kSmall,
kEffectiveSize, EmitTo::kSizeInUkmAndUma, kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetWebCache_OtherResources}, &Memory_Experimental::SetWebCache_OtherResources},
}; };
...@@ -348,11 +355,16 @@ const Metric kAllocatorDumpNamesForMetrics[] = { ...@@ -348,11 +355,16 @@ const Metric kAllocatorDumpNamesForMetrics[] = {
#define EXPERIMENTAL_UMA_PREFIX "Memory.Experimental." #define EXPERIMENTAL_UMA_PREFIX "Memory.Experimental."
#define VERSION_SUFFIX_NORMAL "2." #define VERSION_SUFFIX_NORMAL "2."
#define VERSION_SUFFIX_SMALL "2.Small." #define VERSION_SUFFIX_SMALL "2.Small."
#define VERSION_SUFFIX_TINY "2.Tiny."
// Used to measure KB-granularity memory stats. Range is from 1KB to 500,000KB // Used to measure KB-granularity memory stats. Range is from 10KB to 500,000KB
// (500MB). // (500MB).
#define MEMORY_METRICS_HISTOGRAM_KB(name, value) \ #define MEMORY_METRICS_HISTOGRAM_KB(name, value) \
base::UmaHistogramCustomCounts(name, value, 10, 500000, 100) base::UmaHistogramCustomCounts(name, value, 10, 500000, 100)
// Used to measure byte granularity memory stats. Range is from 1 byte to
// 500,000 bytes (500KB).
#define MEMORY_METRICS_HISTOGRAM_BYTE(name, value) \
base::UmaHistogramCustomCounts(name, value, 1, 500000, 100)
void EmitProcessUkm(const Metric& item, void EmitProcessUkm(const Metric& item,
uint64_t value, uint64_t value,
...@@ -371,19 +383,27 @@ void EmitProcessUma(HistogramProcessType process_type, ...@@ -371,19 +383,27 @@ void EmitProcessUma(HistogramProcessType process_type,
if (base::StringPiece(item.uma_name) == "CommandBuffer") { if (base::StringPiece(item.uma_name) == "CommandBuffer") {
uma_name = uma_name =
EXPERIMENTAL_UMA_PREFIX "Gpu" VERSION_SUFFIX_NORMAL "CommandBuffer"; EXPERIMENTAL_UMA_PREFIX "Gpu" VERSION_SUFFIX_NORMAL "CommandBuffer";
DCHECK(item.is_large_metric); DCHECK(item.metric_size == MetricSize::kLarge);
} else { } else {
const char* version_suffix = const char* version_suffix =
item.is_large_metric ? VERSION_SUFFIX_NORMAL : VERSION_SUFFIX_SMALL; item.metric_size == MetricSize::kLarge ? VERSION_SUFFIX_NORMAL:
item.metric_size == MetricSize::kTiny ? VERSION_SUFFIX_TINY:
VERSION_SUFFIX_SMALL;
uma_name = std::string(EXPERIMENTAL_UMA_PREFIX) + uma_name = std::string(EXPERIMENTAL_UMA_PREFIX) +
HistogramProcessTypeToString(process_type) + version_suffix + HistogramProcessTypeToString(process_type) + version_suffix +
item.uma_name; item.uma_name;
} }
if (item.is_large_metric) { switch (item.metric_size) {
MEMORY_METRICS_HISTOGRAM_MB(uma_name, value / 1024 / 1024); case MetricSize::kLarge:
} else { MEMORY_METRICS_HISTOGRAM_MB(uma_name, value / 1024 / 1024);
MEMORY_METRICS_HISTOGRAM_KB(uma_name, value / 1024); break;
case MetricSize::kSmall:
MEMORY_METRICS_HISTOGRAM_KB(uma_name, value / 1024);
break;
case MetricSize::kTiny:
MEMORY_METRICS_HISTOGRAM_BYTE(uma_name, value);
break;
} }
} }
...@@ -466,7 +486,7 @@ void EmitSummedGpuMemory(const GlobalMemoryDump::ProcessDump& pmd, ...@@ -466,7 +486,7 @@ void EmitSummedGpuMemory(const GlobalMemoryDump::ProcessDump& pmd,
}; };
Metric synthetic_metric = {nullptr, Metric synthetic_metric = {nullptr,
"GpuMemory", "GpuMemory",
kLargeMetric, MetricSize::kLarge,
kEffectiveSize, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetGpuMemory}; &Memory_Experimental::SetGpuMemory};
......
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