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