0

Graphite: emit detailed memory metrics

Including:
- Texture memory.
- Depth stencil texture memory.
- MSAA texture memory.
- buffers memory.

Bug: 402138745
Change-Id: I85cf399e1621e90f16e5ee732549218d3108f7f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6349716
Reviewed-by: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432082}
This commit is contained in:
Le Hoang Quyen
2025-03-13 07:07:25 -07:00
committed by Chromium LUCI CQ
parent f8f8a51015
commit 4657350001
4 changed files with 47 additions and 1 deletions
base/trace_event
chrome/browser/metrics
gpu/command_buffer/service
tools/metrics/histograms/metadata

@ -161,6 +161,10 @@ constexpr auto kAllocatorDumpNameAllowlist =
"frame_evictor", "frame_evictor",
"gpu/command_buffer_memory/buffer_0x?", "gpu/command_buffer_memory/buffer_0x?",
"gpu/dawn", "gpu/dawn",
"gpu/dawn/textures",
"gpu/dawn/textures/depth_stencil",
"gpu/dawn/textures/msaa",
"gpu/dawn/buffers",
"gpu/discardable_cache/cache_0x?", "gpu/discardable_cache/cache_0x?",
"gpu/discardable_cache/cache_0x?/avg_image_size", "gpu/discardable_cache/cache_0x?/avg_image_size",
"gpu/gl/buffers/context_group_0x?", "gpu/gl/buffers/context_group_0x?",

@ -252,6 +252,14 @@ const Metric kAllocatorDumpNamesForMetrics[] = {
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetFontCaches}, EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetFontCaches},
{"gpu/dawn", "DawnSharedContext", MetricSize::kLarge, kEffectiveSize, {"gpu/dawn", "DawnSharedContext", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUmaOnly, nullptr}, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/dawn/textures", "DawnSharedContext.Textures", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/dawn/textures/depth_stencil", "DawnSharedContext.DepthStencil",
MetricSize::kLarge, kEffectiveSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/dawn/textures/msaa", "DawnSharedContext.MSAA", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/dawn/buffers", "DawnSharedContext.Buffers", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUmaOnly, nullptr},
{"gpu/discardable_cache", "ServiceDiscardableManager", MetricSize::kCustom, {"gpu/discardable_cache", "ServiceDiscardableManager", MetricSize::kCustom,
kSize, EmitTo::kSizeInUmaOnly, nullptr, ImageSizeMetricRange}, kSize, EmitTo::kSizeInUmaOnly, nullptr, ImageSizeMetricRange},
{"gpu/discardable_cache", "ServiceDiscardableManager.AvgImageSize", {"gpu/discardable_cache", "ServiceDiscardableManager.AvgImageSize",

@ -831,10 +831,32 @@ bool DawnSharedContext::OnMemoryDump(
if (args.level_of_detail == if (args.level_of_detail ==
base::trace_event::MemoryDumpLevelOfDetail::kBackground) { base::trace_event::MemoryDumpLevelOfDetail::kBackground) {
using base::trace_event::MemoryAllocatorDump; using base::trace_event::MemoryAllocatorDump;
const dawn::native::MemoryUsageInfo mem_usage =
dawn::native::ComputeEstimatedMemoryUsageInfo(device_.Get());
pmd->GetOrCreateAllocatorDump(kDawnMemoryDumpPrefix) pmd->GetOrCreateAllocatorDump(kDawnMemoryDumpPrefix)
->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, mem_usage.totalUsage);
pmd->GetOrCreateAllocatorDump(
base::JoinString({kDawnMemoryDumpPrefix, "textures"}, "/"))
->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, mem_usage.texturesUsage);
pmd
->GetOrCreateAllocatorDump(base::JoinString(
{kDawnMemoryDumpPrefix, "textures/depth_stencil"}, "/"))
->AddScalar(MemoryAllocatorDump::kNameSize, ->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, MemoryAllocatorDump::kUnitsBytes,
dawn::native::ComputeEstimatedMemoryUsage(device_.Get())); mem_usage.depthStencilTexturesUsage);
pmd->GetOrCreateAllocatorDump(
base::JoinString({kDawnMemoryDumpPrefix, "textures/msaa"}, "/"))
->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes,
mem_usage.msaaTexturesUsage);
pmd->GetOrCreateAllocatorDump(
base::JoinString({kDawnMemoryDumpPrefix, "buffers"}, "/"))
->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, mem_usage.buffersUsage);
} else { } else {
DawnMemoryDump dump(pmd); DawnMemoryDump dump(pmd);
dawn::native::DumpMemoryStatistics(device_.Get(), &dump); dawn::native::DumpMemoryStatistics(device_.Get(), &dump);

@ -2777,6 +2777,18 @@ chromium-metrics-reviews@google.com.
label="Only counting memory used by GL command buffers."/> label="Only counting memory used by GL command buffers."/>
<suffix name="DawnSharedContext" <suffix name="DawnSharedContext"
label="Only counting memory used by the Graphite Dawn shared context."/> label="Only counting memory used by the Graphite Dawn shared context."/>
<suffix name="DawnSharedContext.Buffers"
label="Only counting buffers' memory used by the Graphite Dawn shared
context."/>
<suffix name="DawnSharedContext.DepthStencil"
label="Only counting depth stencil textures' memory used by the
Graphite Dawn shared context."/>
<suffix name="DawnSharedContext.MSAA"
label="Only counting MSAA memory used by the Graphite Dawn shared
context."/>
<suffix name="DawnSharedContext.Textures"
label="Only counting textures' memory used by the Graphite Dawn shared
context."/>
<suffix name="Discardable" <suffix name="Discardable"
label="Only counting memory used by Discardable manager."/> label="Only counting memory used by Discardable manager."/>
<suffix name="ExtensionFunctions" <suffix name="ExtensionFunctions"