Commit 9bf7eaf6 authored by Benoit Lize's avatar Benoit Lize Committed by Commit Bot

[PartitionAlloc] Record thread cache stats for light memory dumps.

Background memory dumps are used for UMA reporting, and thread cache
stats are only reported for full ones. Collect them for all dumps, to
appear correctly in UMA.

Bug: 998048
Change-Id: I5810b839909ec94ed779d7b4034cbd53c13f0891
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553552
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831055}
parent a36c6e3a
...@@ -702,7 +702,7 @@ void PartitionRoot<thread_safe>::DumpStats(const char* partition_name, ...@@ -702,7 +702,7 @@ void PartitionRoot<thread_safe>::DumpStats(const char* partition_name,
stats.total_resident_bytes += direct_mapped_allocations_total_size; stats.total_resident_bytes += direct_mapped_allocations_total_size;
stats.total_active_bytes += direct_mapped_allocations_total_size; stats.total_active_bytes += direct_mapped_allocations_total_size;
stats.has_thread_cache = !is_light_dump && with_thread_cache; stats.has_thread_cache = with_thread_cache;
if (stats.has_thread_cache) { if (stats.has_thread_cache) {
internal::ThreadCacheRegistry::Instance().DumpStats( internal::ThreadCacheRegistry::Instance().DumpStats(
true, &stats.current_thread_cache_stats); true, &stats.current_thread_cache_stats);
......
...@@ -65,10 +65,10 @@ void WinHeapMemoryDumpImpl(WinHeapInfo* crt_heap_info) { ...@@ -65,10 +65,10 @@ void WinHeapMemoryDumpImpl(WinHeapInfo* crt_heap_info) {
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
void ReportDetailedPartitionAllocStats(ProcessMemoryDump* pmd) { void ReportPartitionAllocStats(ProcessMemoryDump* pmd, bool detailed) {
SimplePartitionStatsDumper allocator_dumper; SimplePartitionStatsDumper allocator_dumper;
internal::PartitionAllocMalloc::Allocator()->DumpStats("malloc", false, internal::PartitionAllocMalloc::Allocator()->DumpStats(
&allocator_dumper); "malloc", !detailed /* is_light_dump */, &allocator_dumper);
if (allocator_dumper.stats().has_thread_cache) { if (allocator_dumper.stats().has_thread_cache) {
const auto& stats = allocator_dumper.stats().all_thread_caches_stats; const auto& stats = allocator_dumper.stats().all_thread_caches_stats;
...@@ -113,9 +113,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, ...@@ -113,9 +113,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
size_t allocated_objects_size = 0; size_t allocated_objects_size = 0;
size_t allocated_objects_count = 0; size_t allocated_objects_count = 0;
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { ReportPartitionAllocStats(
ReportDetailedPartitionAllocStats(pmd); pmd, args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED);
}
#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) #endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#if BUILDFLAG(USE_TCMALLOC) #if BUILDFLAG(USE_TCMALLOC)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <string> #include <string>
#include "base/allocator/buildflags.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
namespace base { namespace base {
...@@ -136,6 +137,10 @@ const char* const kAllocatorDumpNameAllowlist[] = { ...@@ -136,6 +137,10 @@ const char* const kAllocatorDumpNameAllowlist[] = {
"malloc", "malloc",
"malloc/allocated_objects", "malloc/allocated_objects",
"malloc/metadata_fragmentation_caches", "malloc/metadata_fragmentation_caches",
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
"malloc/thread_cache",
"malloc/thread_cache/main_thread",
#endif
"media/webmediaplayer/audio/player_0x?", "media/webmediaplayer/audio/player_0x?",
"media/webmediaplayer/data_source/player_0x?", "media/webmediaplayer/data_source/player_0x?",
"media/webmediaplayer/demuxer/player_0x?", "media/webmediaplayer/demuxer/player_0x?",
...@@ -285,6 +290,10 @@ const char* const kAllocatorDumpNameAllowlist[] = { ...@@ -285,6 +290,10 @@ const char* const kAllocatorDumpNameAllowlist[] = {
"partition_alloc/partitions/array_buffer", "partition_alloc/partitions/array_buffer",
"partition_alloc/partitions/buffer", "partition_alloc/partitions/buffer",
"partition_alloc/partitions/fast_malloc", "partition_alloc/partitions/fast_malloc",
#if !BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
"partition_alloc/partitions/fast_malloc/thread_cache",
"partition_alloc/partitions/fast_malloc/thread_cache/main_thread",
#endif
"partition_alloc/partitions/layout", "partition_alloc/partitions/layout",
"skia/gpu_resources/context_0x?", "skia/gpu_resources/context_0x?",
"skia/sk_glyph_cache", "skia/sk_glyph_cache",
......
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