address_space_stats.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_STATS_H_
  5. #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_STATS_H_
  6. #include <cstddef>
  7. #include "base/allocator/partition_allocator/partition_alloc_base/component_export.h"
  8. #include "base/allocator/partition_allocator/partition_alloc_buildflags.h"
  9. #include "base/allocator/partition_allocator/partition_alloc_config.h"
  10. namespace partition_alloc {
  11. // All members are measured in super pages.
  12. struct PoolStats {
  13. size_t usage = 0;
  14. // On 32-bit, GigaCage is mainly a logical entity, intermingled with
  15. // allocations not managed by PartitionAlloc. The "largest available
  16. // reservation" is not possible to measure in that case.
  17. #if defined(PA_HAS_64_BITS_POINTERS)
  18. size_t largest_available_reservation = 0;
  19. #endif // defined(PA_HAS_64_BITS_POINTERS)
  20. };
  21. struct AddressSpaceStats {
  22. PoolStats regular_pool_stats;
  23. #if BUILDFLAG(USE_BACKUP_REF_PTR)
  24. PoolStats brp_pool_stats;
  25. #endif // BUILDFLAG(USE_BACKUP_REF_PTR)
  26. #if defined(PA_HAS_64_BITS_POINTERS)
  27. PoolStats configurable_pool_stats;
  28. #else
  29. #if BUILDFLAG(USE_BACKUP_REF_PTR)
  30. size_t blocklist_size; // measured in super pages
  31. size_t blocklist_hit_count;
  32. #endif // BUILDFLAG(USE_BACKUP_REF_PTR)
  33. #endif // defined(PA_HAS_64_BITS_POINTERS)
  34. };
  35. // Interface passed to `AddressPoolManager::DumpStats()` to mediate
  36. // for `AddressSpaceDumpProvider`.
  37. class PA_COMPONENT_EXPORT(PARTITION_ALLOC) AddressSpaceStatsDumper {
  38. public:
  39. virtual void DumpStats(const AddressSpaceStats* address_space_stats) = 0;
  40. };
  41. } // namespace partition_alloc
  42. #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_ADDRESS_SPACE_STATS_H_