| Index: base/metrics/histogram.cc
|
| ===================================================================
|
| --- base/metrics/histogram.cc (revision 76254)
|
| +++ base/metrics/histogram.cc (working copy)
|
| @@ -86,7 +86,7 @@
|
| if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
|
| histogram = new Histogram(name, minimum, maximum, bucket_count);
|
| histogram->InitializeBucketRange();
|
| - StatisticsRecorder::Register(&histogram);
|
| + StatisticsRecorder::RegisterOrDiscardDuplicate(&histogram);
|
| }
|
|
|
| DCHECK_EQ(HISTOGRAM, histogram->histogram_type());
|
| @@ -415,10 +415,6 @@
|
| DCHECK(ValidateBucketRanges());
|
| }
|
|
|
| -bool Histogram::PrintEmptyBucket(size_t index) const {
|
| - return true;
|
| -}
|
| -
|
| // Calculate what range of values are held in each bucket.
|
| // We have to be careful that we don't pick a ratio between starting points in
|
| // consecutive buckets that is sooo small, that the integer bounds are the same
|
| @@ -454,6 +450,10 @@
|
| DCHECK_EQ(bucket_count(), bucket_index);
|
| }
|
|
|
| +bool Histogram::PrintEmptyBucket(size_t index) const {
|
| + return true;
|
| +}
|
| +
|
| size_t Histogram::BucketIndex(Sample value) const {
|
| // Use simple binary search. This is very general, but there are better
|
| // approaches if we knew that the buckets were linearly distributed.
|
| @@ -791,7 +791,7 @@
|
| new LinearHistogram(name, minimum, maximum, bucket_count);
|
| linear_histogram->InitializeBucketRange();
|
| histogram = linear_histogram;
|
| - StatisticsRecorder::Register(&histogram);
|
| + StatisticsRecorder::RegisterOrDiscardDuplicate(&histogram);
|
| }
|
|
|
| DCHECK_EQ(LINEAR_HISTOGRAM, histogram->histogram_type());
|
| @@ -883,7 +883,7 @@
|
| BooleanHistogram* boolean_histogram = new BooleanHistogram(name);
|
| boolean_histogram->InitializeBucketRange();
|
| histogram = boolean_histogram;
|
| - StatisticsRecorder::Register(&histogram);
|
| + StatisticsRecorder::RegisterOrDiscardDuplicate(&histogram);
|
| }
|
|
|
| DCHECK_EQ(BOOLEAN_HISTOGRAM, histogram->histogram_type());
|
| @@ -930,7 +930,7 @@
|
| CustomHistogram* custom_histogram = new CustomHistogram(name, ranges);
|
| custom_histogram->InitializedCustomBucketRange(ranges);
|
| histogram = custom_histogram;
|
| - StatisticsRecorder::Register(&histogram);
|
| + StatisticsRecorder::RegisterOrDiscardDuplicate(&histogram);
|
| }
|
|
|
| DCHECK_EQ(histogram->histogram_type(), CUSTOM_HISTOGRAM);
|
| @@ -1023,7 +1023,8 @@
|
| // was passed to us, decremented it when we returned, and the instance would be
|
| // destroyed before assignment (when value was returned by new).
|
| // static
|
| -void StatisticsRecorder::Register(scoped_refptr<Histogram>* histogram) {
|
| +void StatisticsRecorder::RegisterOrDiscardDuplicate(
|
| + scoped_refptr<Histogram>* histogram) {
|
| DCHECK((*histogram)->HasValidRangeChecksum());
|
| if (lock_ == NULL)
|
| return;
|
|
|