| Index: base/metrics/histogram.h
|
| diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
|
| index 8840493af098437104ed0ba8693e72e860360ab9..7b8684214677f35a47bc185d0bfe2451e7a01965 100644
|
| --- a/base/metrics/histogram.h
|
| +++ b/base/metrics/histogram.h
|
| @@ -89,10 +89,13 @@ class BooleanHistogram;
|
| class CustomHistogram;
|
| class Histogram;
|
| class LinearHistogram;
|
| +class PersistentMemoryAllocator;
|
| class Pickle;
|
| class PickleIterator;
|
| class SampleVector;
|
|
|
| +struct PersistentHistogramData;
|
| +
|
| class BASE_EXPORT Histogram : public HistogramBase {
|
| public:
|
| // Initialize maximum number of buckets in histograms as 16,384.
|
| @@ -190,6 +193,13 @@ class BASE_EXPORT Histogram : public HistogramBase {
|
| void WriteAscii(std::string* output) const override;
|
|
|
| protected:
|
| + // This class, defined entirely within the .cc file, contains all the
|
| + // common logic for building a Histogram and can be overridden by more
|
| + // specific types to alter details of how the creation is done. It is
|
| + // defined as an embedded class (rather than an anonymous one) so it
|
| + // can access the protected constructors.
|
| + class Factory;
|
| +
|
| // |ranges| should contain the underflow and overflow buckets. See top
|
| // comments for example.
|
| Histogram(const std::string& name,
|
| @@ -197,6 +207,20 @@ class BASE_EXPORT Histogram : public HistogramBase {
|
| Sample maximum,
|
| const BucketRanges* ranges);
|
|
|
| + // Traditionally, histograms allocate their own memory for the bucket
|
| + // vector but "shared" histograms use memory regions allocated from a
|
| + // special memory segment that is passed in here. It is assumed that
|
| + // the life of this memory is managed externally and exceeds the lifetime
|
| + // of this object. Practically, this memory is never released until the
|
| + // process exits and the OS cleans it up.
|
| + Histogram(const std::string& name,
|
| + Sample minimum,
|
| + Sample maximum,
|
| + const BucketRanges* ranges,
|
| + HistogramBase::AtomicCount* counts,
|
| + size_t counts_size,
|
| + HistogramSamples::Metadata* meta);
|
| +
|
| ~Histogram() override;
|
|
|
| // HistogramBase implementation:
|
| @@ -225,6 +249,9 @@ class BASE_EXPORT Histogram : public HistogramBase {
|
| friend class StatisticsRecorder; // To allow it to delete duplicates.
|
| friend class StatisticsRecorderTest;
|
|
|
| + friend BASE_EXPORT HistogramBase* CreatePersistentHistogram(
|
| + PersistentMemoryAllocator* allocator,
|
| + PersistentHistogramData* histogram_data);
|
| friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
|
| base::PickleIterator* iter);
|
| static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
|
| @@ -334,11 +361,21 @@ class BASE_EXPORT LinearHistogram : public Histogram {
|
| HistogramType GetHistogramType() const override;
|
|
|
| protected:
|
| + class Factory;
|
| +
|
| LinearHistogram(const std::string& name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges);
|
|
|
| + LinearHistogram(const std::string& name,
|
| + Sample minimum,
|
| + Sample maximum,
|
| + const BucketRanges* ranges,
|
| + HistogramBase::AtomicCount* counts,
|
| + size_t counts_size,
|
| + HistogramSamples::Metadata* meta);
|
| +
|
| double GetBucketSize(Count current, size_t i) const override;
|
|
|
| // If we have a description for a bucket, then return that. Otherwise
|
| @@ -350,6 +387,9 @@ class BASE_EXPORT LinearHistogram : public Histogram {
|
| bool PrintEmptyBucket(size_t index) const override;
|
|
|
| private:
|
| + friend BASE_EXPORT HistogramBase* CreatePersistentHistogram(
|
| + PersistentMemoryAllocator* allocator,
|
| + PersistentHistogramData* histogram_data);
|
| friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
|
| base::PickleIterator* iter);
|
| static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
|
| @@ -377,9 +417,19 @@ class BASE_EXPORT BooleanHistogram : public LinearHistogram {
|
|
|
| HistogramType GetHistogramType() const override;
|
|
|
| + protected:
|
| + class Factory;
|
| +
|
| private:
|
| BooleanHistogram(const std::string& name, const BucketRanges* ranges);
|
| -
|
| + BooleanHistogram(const std::string& name,
|
| + const BucketRanges* ranges,
|
| + HistogramBase::AtomicCount* counts,
|
| + HistogramSamples::Metadata* meta);
|
| +
|
| + friend BASE_EXPORT HistogramBase* CreatePersistentHistogram(
|
| + PersistentMemoryAllocator* allocator,
|
| + PersistentHistogramData* histogram_data);
|
| friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
|
| base::PickleIterator* iter);
|
| static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
|
| @@ -419,22 +469,31 @@ class BASE_EXPORT CustomHistogram : public Histogram {
|
| static std::vector<Sample> ArrayToCustomRanges(const Sample* values,
|
| size_t num_values);
|
| protected:
|
| + class Factory;
|
| +
|
| CustomHistogram(const std::string& name,
|
| const BucketRanges* ranges);
|
|
|
| + CustomHistogram(const std::string& name,
|
| + const BucketRanges* ranges,
|
| + HistogramBase::AtomicCount* counts,
|
| + size_t counts_size,
|
| + HistogramSamples::Metadata* meta);
|
| +
|
| // HistogramBase implementation:
|
| bool SerializeInfoImpl(base::Pickle* pickle) const override;
|
|
|
| double GetBucketSize(Count current, size_t i) const override;
|
|
|
| private:
|
| + friend BASE_EXPORT HistogramBase* CreatePersistentHistogram(
|
| + PersistentMemoryAllocator* allocator,
|
| + PersistentHistogramData* histogram_data);
|
| friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
|
| base::PickleIterator* iter);
|
| static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
|
|
|
| static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges);
|
| - static BucketRanges* CreateBucketRangesFromCustomRanges(
|
| - const std::vector<Sample>& custom_ranges);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
|
| };
|
|
|