chromium/base/allocator/partition_allocator/src/partition_alloc/partition_stats.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PARTITION_ALLOC_PARTITION_STATS_H_
#define PARTITION_ALLOC_PARTITION_STATS_H_

#include <cstddef>
#include <cstdint>

#include "partition_alloc/buildflags.h"
#include "partition_alloc/partition_alloc_base/component_export.h"
#include "partition_alloc/partition_alloc_config.h"
#include "partition_alloc/partition_alloc_constants.h"

namespace partition_alloc {

// Most of these are not populated if PA_THREAD_CACHE_ENABLE_STATISTICS is not
// defined.
struct ThreadCacheStats {};

// Per-thread allocation statistics. Only covers allocations made through the
// partition linked to the thread cache. As the allocator doesn't record
// requested sizes in most cases, the data there will be an overestimate of the
// actually requested sizes. It is also not expected to sum up to anything
// meaningful across threads, due to the lack of synchronization. Figures there
// are cumulative, not net. Since the data below is per-thread, note a thread
// can deallocate more than it allocated.
struct ThreadAllocStats {};

struct LightweightQuarantineStats {};

// Struct used to retrieve total memory usage of a partition. Used by
// PartitionStatsDumper implementation.
struct PartitionMemoryStats {};

// Struct used to retrieve memory statistics about a partition bucket. Used by
// PartitionStatsDumper implementation.
struct PartitionBucketMemoryStats {};

// Interface that is passed to PartitionDumpStats and
// PartitionDumpStats for using the memory statistics.
class PA_COMPONENT_EXPORT(PARTITION_ALLOC) PartitionStatsDumper {};

// Simple version of PartitionStatsDumper, storing the returned stats in stats_.
// Does not handle per-bucket stats.
class PA_COMPONENT_EXPORT(PARTITION_ALLOC) SimplePartitionStatsDumper
    : public PartitionStatsDumper {};

}  // namespace partition_alloc

#endif  // PARTITION_ALLOC_PARTITION_STATS_H_