Commit cf249d23 authored by Bartek Nowierski's avatar Bartek Nowierski Committed by Commit Bot

[PartitionAlloc] Move ThreadCacheStats to partition_stats.h

Change-Id: Ie9eda8b5e696099cf080b8a3477267076185b936
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2502708
Auto-Submit: Bartek Nowierski <bartekn@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Commit-Queue: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822882}
parent 22a4add2
......@@ -5,10 +5,36 @@
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_STATS_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_STATS_H_
#include "base/allocator/partition_allocator/thread_cache.h"
#include <cstddef>
#include <cstdint>
#include "base/base_export.h"
namespace base {
// Most of these are not populated if PA_ENABLE_THREAD_CACHE_STATISTICS is not
// defined.
struct ThreadCacheStats {
uint64_t alloc_count; // Total allocation requests.
uint64_t alloc_hits; // Thread cache hits.
uint64_t alloc_misses; // Thread cache misses.
// Allocation failure details:
uint64_t alloc_miss_empty;
uint64_t alloc_miss_too_large;
// Cache fill details:
uint64_t cache_fill_count;
uint64_t cache_fill_hits;
uint64_t cache_fill_misses;
uint64_t cache_fill_bucket_full;
uint64_t cache_fill_too_large;
// Memory cost:
uint64_t bucket_total_memory;
uint64_t metadata_overhead;
};
// Struct used to retrieve total memory usage of a partition. Used by
// PartitionStatsDumper implementation.
struct PartitionMemoryStats {
......@@ -20,8 +46,8 @@ struct PartitionMemoryStats {
size_t total_discardable_bytes; // Total bytes that could be discarded.
bool has_thread_cache;
internal::ThreadCacheStats current_thread_cache_stats;
internal::ThreadCacheStats all_thread_caches_stats;
ThreadCacheStats current_thread_cache_stats;
ThreadCacheStats all_thread_caches_stats;
};
// Struct used to retrieve memory statistics about a partition bucket. Used by
......
......@@ -6,13 +6,13 @@
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_THREAD_CACHE_H_
#include <atomic>
#include <cstdint>
#include <memory>
#include "base/allocator/partition_allocator/partition_alloc_forward.h"
#include "base/allocator/partition_allocator/partition_cookie.h"
#include "base/allocator/partition_allocator/partition_freelist_entry.h"
#include "base/allocator/partition_allocator/partition_lock.h"
#include "base/allocator/partition_allocator/partition_stats.h"
#include "base/allocator/partition_allocator/partition_tls.h"
#include "base/base_export.h"
#include "base/gtest_prod_util.h"
......@@ -33,29 +33,6 @@ class ThreadCache;
extern BASE_EXPORT PartitionTlsKey g_thread_cache_key;
// Most of these are not populated if PA_ENABLE_THREAD_CACHE_STATISTICS is not
// defined.
struct ThreadCacheStats {
uint64_t alloc_count; // Total allocation requests.
uint64_t alloc_hits; // Thread cache hits.
uint64_t alloc_misses; // Thread cache misses.
// Allocation failure details:
uint64_t alloc_miss_empty;
uint64_t alloc_miss_too_large;
// Cache fill details:
uint64_t cache_fill_count;
uint64_t cache_fill_hits;
uint64_t cache_fill_misses;
uint64_t cache_fill_bucket_full;
uint64_t cache_fill_too_large;
// Memory cost:
uint64_t bucket_total_memory;
uint64_t metadata_overhead;
};
// Global registry of all ThreadCache instances.
//
// This class cannot allocate in the (Un)registerThreadCache() functions, as
......
......@@ -215,9 +215,8 @@ void MallocDumpProvider::DisableMetrics() {
}
#if BUILDFLAG(USE_PARTITION_ALLOC)
void ReportPartitionAllocThreadCacheStats(
MemoryAllocatorDump* dump,
const internal::ThreadCacheStats& stats) {
void ReportPartitionAllocThreadCacheStats(MemoryAllocatorDump* dump,
const ThreadCacheStats& stats) {
dump->AddScalar("alloc_count", "scalar", stats.alloc_count);
dump->AddScalar("alloc_hits", "scalar", stats.alloc_hits);
dump->AddScalar("alloc_misses", "scalar", stats.alloc_misses);
......
......@@ -60,7 +60,7 @@ class MemoryAllocatorDump;
BASE_EXPORT void ReportPartitionAllocThreadCacheStats(
MemoryAllocatorDump* dump,
const internal::ThreadCacheStats& stats);
const ThreadCacheStats& stats);
#endif // BUILDFLAG(USE_PARTITION_ALLOC)
} // namespace trace_event
......
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