#include "base/metrics/histogram_samples.h"
#include <limits>
#include <string_view>
#include <utility>
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/clamped_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
#include "base/pickle.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
namespace base {
namespace {
constexpr size_t kSizeMax = …;
constexpr int32_t kDisabledSingleSample = …;
class SampleCountPickleIterator : public SampleCountIterator { … };
SampleCountPickleIterator::SampleCountPickleIterator(PickleIterator* iter)
: … { … }
bool SampleCountPickleIterator::Done() const { … }
void SampleCountPickleIterator::Next() { … }
void SampleCountPickleIterator::Get(HistogramBase::Sample* min,
int64_t* max,
HistogramBase::Count* count) { … }
}
static_assert …;
HistogramSamples::SingleSample HistogramSamples::AtomicSingleSample::Load()
const { … }
HistogramSamples::SingleSample HistogramSamples::AtomicSingleSample::Extract(
AtomicSingleSample new_value) { … }
HistogramSamples::SingleSample
HistogramSamples::AtomicSingleSample::ExtractAndDisable() { … }
bool HistogramSamples::AtomicSingleSample::Accumulate(
size_t bucket,
HistogramBase::Count count) { … }
bool HistogramSamples::AtomicSingleSample::IsDisabled() const { … }
HistogramSamples::LocalMetadata::LocalMetadata() { … }
HistogramSamples::HistogramSamples(uint64_t id, Metadata* meta)
: … { … }
HistogramSamples::HistogramSamples(uint64_t id, std::unique_ptr<Metadata> meta)
: … { … }
HistogramSamples::~HistogramSamples() = default;
void HistogramSamples::Add(const HistogramSamples& other) { … }
bool HistogramSamples::AddFromPickle(PickleIterator* iter) { … }
void HistogramSamples::Subtract(const HistogramSamples& other) { … }
void HistogramSamples::Extract(HistogramSamples& other) { … }
bool HistogramSamples::IsDefinitelyEmpty() const { … }
void HistogramSamples::Serialize(Pickle* pickle) const { … }
bool HistogramSamples::AccumulateSingleSample(HistogramBase::Sample value,
HistogramBase::Count count,
size_t bucket) { … }
void HistogramSamples::IncreaseSumAndCount(int64_t sum,
HistogramBase::Count count) { … }
void HistogramSamples::RecordNegativeSample(NegativeSampleReason reason,
HistogramBase::Count increment) { … }
base::Value::Dict HistogramSamples::ToGraphDict(std::string_view histogram_name,
int32_t flags) const { … }
std::string HistogramSamples::GetAsciiHeader(std::string_view histogram_name,
int32_t flags) const { … }
std::string HistogramSamples::GetAsciiBody() const { … }
void HistogramSamples::WriteAsciiBucketGraph(double x_count,
int line_length,
std::string* output) { … }
void HistogramSamples::WriteAsciiBucketValue(HistogramBase::Count current,
double scaled_sum,
std::string* output) const { … }
const std::string HistogramSamples::GetSimpleAsciiBucketRange(
HistogramBase::Sample sample) const { … }
SampleCountIterator::~SampleCountIterator() = default;
bool SampleCountIterator::GetBucketIndex(size_t* index) const { … }
SingleSampleIterator::SingleSampleIterator(HistogramBase::Sample min,
int64_t max,
HistogramBase::Count count,
size_t bucket_index,
bool value_was_extracted)
: … { … }
SingleSampleIterator::~SingleSampleIterator() { … }
bool SingleSampleIterator::Done() const { … }
void SingleSampleIterator::Next() { … }
void SingleSampleIterator::Get(HistogramBase::Sample* min,
int64_t* max,
HistogramBase::Count* count) { … }
bool SingleSampleIterator::GetBucketIndex(size_t* index) const { … }
}