chromium/base/metrics/histogram_samples.cc

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

#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 {

// A shorthand constant for the max value of size_t.
constexpr size_t kSizeMax =;

// A constant stored in an AtomicSingleSample (as_atomic) to indicate that the
// sample is "disabled" and no further accumulation should be done with it. The
// value is chosen such that it will be MAX_UINT16 for both |bucket| & |count|,
// and thus less likely to conflict with real use. Conflicts are explicitly
// handled in the code but it's worth making them as unlikely as possible.
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) {}

}  // namespace

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)
    :{}

// This mustn't do anything with |meta_|. It was passed to the ctor and may
// be invalid by the time this dtor gets called.
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 {}

// static
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 {}

}  // namespace base