| Index: base/metrics/histogram.cc
|
| diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
|
| index e1d0df6736fa326b5f74c717974f40bf711be0c9..bf22ffcc2e3fedc3f57715d5444f5ccf361ffc62 100644
|
| --- a/base/metrics/histogram.cc
|
| +++ b/base/metrics/histogram.cc
|
| @@ -275,14 +275,12 @@ std::unique_ptr<HistogramBase> Histogram::PersistentCreate(
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| HistogramSamples::Metadata* meta,
|
| HistogramSamples::Metadata* logged_meta) {
|
| return WrapUnique(new Histogram(name, minimum, maximum, ranges, counts,
|
| - logged_counts, counts_size, meta,
|
| - logged_meta));
|
| + logged_counts, meta, logged_meta));
|
| }
|
|
|
| // Calculate what range of values are held in each bucket.
|
| @@ -512,20 +510,19 @@ Histogram::Histogram(const std::string& name,
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| HistogramSamples::Metadata* meta,
|
| HistogramSamples::Metadata* logged_meta)
|
| - : HistogramBase(name),
|
| - bucket_ranges_(ranges),
|
| - declared_min_(minimum),
|
| - declared_max_(maximum) {
|
| + : HistogramBase(name),
|
| + bucket_ranges_(ranges),
|
| + declared_min_(minimum),
|
| + declared_max_(maximum) {
|
| if (ranges) {
|
| - samples_.reset(new SampleVector(HashMetricName(name),
|
| - counts, counts_size, meta, ranges));
|
| - logged_samples_.reset(new SampleVector(samples_->id(), logged_counts,
|
| - counts_size, logged_meta, ranges));
|
| + samples_.reset(
|
| + new PersistentSampleVector(HashMetricName(name), ranges, meta, counts));
|
| + logged_samples_.reset(new PersistentSampleVector(
|
| + samples_->id(), ranges, logged_meta, logged_counts));
|
| }
|
| }
|
|
|
| @@ -656,7 +653,7 @@ void Histogram::WriteAsciiImpl(bool graph_it,
|
| DCHECK_EQ(sample_count, past);
|
| }
|
|
|
| -double Histogram::GetPeakBucketSize(const SampleVector& samples) const {
|
| +double Histogram::GetPeakBucketSize(const SampleVectorBase& samples) const {
|
| double max = 0;
|
| for (uint32_t i = 0; i < bucket_count() ; ++i) {
|
| double current_size = GetBucketSize(samples.GetCountAtIndex(i), i);
|
| @@ -666,7 +663,7 @@ double Histogram::GetPeakBucketSize(const SampleVector& samples) const {
|
| return max;
|
| }
|
|
|
| -void Histogram::WriteAsciiHeader(const SampleVector& samples,
|
| +void Histogram::WriteAsciiHeader(const SampleVectorBase& samples,
|
| Count sample_count,
|
| std::string* output) const {
|
| StringAppendF(output,
|
| @@ -815,14 +812,12 @@ std::unique_ptr<HistogramBase> LinearHistogram::PersistentCreate(
|
| Sample minimum,
|
| Sample maximum,
|
| const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| HistogramSamples::Metadata* meta,
|
| HistogramSamples::Metadata* logged_meta) {
|
| - return WrapUnique(new LinearHistogram(name, minimum, maximum, ranges,
|
| - counts, logged_counts,
|
| - counts_size, meta, logged_meta));
|
| + return WrapUnique(new LinearHistogram(name, minimum, maximum, ranges, counts,
|
| + logged_counts, meta, logged_meta));
|
| }
|
|
|
| HistogramBase* LinearHistogram::FactoryGetWithRangeDescription(
|
| @@ -851,17 +846,23 @@ LinearHistogram::LinearHistogram(const std::string& name,
|
| : Histogram(name, minimum, maximum, ranges) {
|
| }
|
|
|
| -LinearHistogram::LinearHistogram(const std::string& name,
|
| - Sample minimum,
|
| - Sample maximum,
|
| - const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| - HistogramSamples::Metadata* meta,
|
| - HistogramSamples::Metadata* logged_meta)
|
| - : Histogram(name, minimum, maximum, ranges, counts, logged_counts,
|
| - counts_size, meta, logged_meta) {}
|
| +LinearHistogram::LinearHistogram(
|
| + const std::string& name,
|
| + Sample minimum,
|
| + Sample maximum,
|
| + const BucketRanges* ranges,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| + HistogramSamples::Metadata* meta,
|
| + HistogramSamples::Metadata* logged_meta)
|
| + : Histogram(name,
|
| + minimum,
|
| + maximum,
|
| + ranges,
|
| + counts,
|
| + logged_counts,
|
| + meta,
|
| + logged_meta) {}
|
|
|
| double LinearHistogram::GetBucketSize(Count current, uint32_t i) const {
|
| DCHECK_GT(ranges(i + 1), ranges(i));
|
| @@ -961,12 +962,12 @@ HistogramBase* BooleanHistogram::FactoryGet(const char* name, int32_t flags) {
|
| std::unique_ptr<HistogramBase> BooleanHistogram::PersistentCreate(
|
| const std::string& name,
|
| const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| HistogramSamples::Metadata* meta,
|
| HistogramSamples::Metadata* logged_meta) {
|
| - return WrapUnique(new BooleanHistogram(
|
| - name, ranges, counts, logged_counts, meta, logged_meta));
|
| + return WrapUnique(new BooleanHistogram(name, ranges, counts, logged_counts,
|
| + meta, logged_meta));
|
| }
|
|
|
| HistogramType BooleanHistogram::GetHistogramType() const {
|
| @@ -977,13 +978,20 @@ BooleanHistogram::BooleanHistogram(const std::string& name,
|
| const BucketRanges* ranges)
|
| : LinearHistogram(name, 1, 2, ranges) {}
|
|
|
| -BooleanHistogram::BooleanHistogram(const std::string& name,
|
| - const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - HistogramSamples::Metadata* meta,
|
| - HistogramSamples::Metadata* logged_meta)
|
| - : LinearHistogram(name, 1, 2, ranges, counts, logged_counts, 2, meta,
|
| +BooleanHistogram::BooleanHistogram(
|
| + const std::string& name,
|
| + const BucketRanges* ranges,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| + HistogramSamples::Metadata* meta,
|
| + HistogramSamples::Metadata* logged_meta)
|
| + : LinearHistogram(name,
|
| + 1,
|
| + 2,
|
| + ranges,
|
| + counts,
|
| + logged_counts,
|
| + meta,
|
| logged_meta) {}
|
|
|
| HistogramBase* BooleanHistogram::DeserializeInfoImpl(PickleIterator* iter) {
|
| @@ -1068,13 +1076,12 @@ HistogramBase* CustomHistogram::FactoryGet(
|
| std::unique_ptr<HistogramBase> CustomHistogram::PersistentCreate(
|
| const std::string& name,
|
| const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| HistogramSamples::Metadata* meta,
|
| HistogramSamples::Metadata* logged_meta) {
|
| - return WrapUnique(new CustomHistogram(
|
| - name, ranges, counts, logged_counts, counts_size, meta, logged_meta));
|
| + return WrapUnique(new CustomHistogram(name, ranges, counts, logged_counts,
|
| + meta, logged_meta));
|
| }
|
|
|
| HistogramType CustomHistogram::GetHistogramType() const {
|
| @@ -1103,20 +1110,19 @@ CustomHistogram::CustomHistogram(const std::string& name,
|
| ranges->range(ranges->bucket_count() - 1),
|
| ranges) {}
|
|
|
| -CustomHistogram::CustomHistogram(const std::string& name,
|
| - const BucketRanges* ranges,
|
| - HistogramBase::AtomicCount* counts,
|
| - HistogramBase::AtomicCount* logged_counts,
|
| - uint32_t counts_size,
|
| - HistogramSamples::Metadata* meta,
|
| - HistogramSamples::Metadata* logged_meta)
|
| +CustomHistogram::CustomHistogram(
|
| + const std::string& name,
|
| + const BucketRanges* ranges,
|
| + const DelayedPersistentAllocation& counts,
|
| + const DelayedPersistentAllocation& logged_counts,
|
| + HistogramSamples::Metadata* meta,
|
| + HistogramSamples::Metadata* logged_meta)
|
| : Histogram(name,
|
| ranges->range(1),
|
| ranges->range(ranges->bucket_count() - 1),
|
| ranges,
|
| counts,
|
| logged_counts,
|
| - counts_size,
|
| meta,
|
| logged_meta) {}
|
|
|
|
|