#include "base/metrics/persistent_sample_map.h"
#include "base/atomicops.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/debug/crash_logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/persistent_histogram_allocator.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
namespace base {
Count;
Sample;
namespace {
template <typename T, typename I>
class IteratorTemplate : public SampleCountIterator { … };
SampleToCountMap;
PersistentSampleMapIterator;
template <>
PersistentSampleMapIterator::~IteratorTemplate() = default;
template <>
void PersistentSampleMapIterator::Get(Sample* min, int64_t* max, Count* count) { … }
ExtractingPersistentSampleMapIterator;
template <>
ExtractingPersistentSampleMapIterator::~IteratorTemplate() { … }
template <>
void ExtractingPersistentSampleMapIterator::Get(Sample* min,
int64_t* max,
Count* count) { … }
struct SampleRecord { … };
}
PersistentSampleMap::PersistentSampleMap(
uint64_t id,
PersistentHistogramAllocator* allocator,
Metadata* meta)
: … { … }
PersistentSampleMap::~PersistentSampleMap() = default;
void PersistentSampleMap::Accumulate(Sample value, Count count) { … }
Count PersistentSampleMap::GetCount(Sample value) const { … }
Count PersistentSampleMap::TotalCount() const { … }
std::unique_ptr<SampleCountIterator> PersistentSampleMap::Iterator() const { … }
std::unique_ptr<SampleCountIterator> PersistentSampleMap::ExtractingIterator() { … }
bool PersistentSampleMap::IsDefinitelyEmpty() const { … }
PersistentMemoryAllocator::Reference
PersistentSampleMap::GetNextPersistentRecord(
PersistentMemoryAllocator::Iterator& iterator,
uint64_t* sample_map_id,
Sample* value) { … }
PersistentMemoryAllocator::Reference
PersistentSampleMap::CreatePersistentRecord(
PersistentMemoryAllocator* allocator,
uint64_t sample_map_id,
Sample value) { … }
bool PersistentSampleMap::AddSubtractImpl(SampleCountIterator* iter,
Operator op) { … }
Count* PersistentSampleMap::GetSampleCountStorage(Sample value) { … }
Count* PersistentSampleMap::GetOrCreateSampleCountStorage(Sample value) { … }
PersistentSampleMapRecords* PersistentSampleMap::GetRecords() { … }
Count* PersistentSampleMap::ImportSamples(std::optional<Sample> until_value) { … }
}