diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 02:54:14 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 02:54:14 +0000 |
commit | 141ba0fbc6d11e6b2d4e7411d266037d1bac11cf (patch) | |
tree | 377291ceb325ae7f8825b40fc6e51d35b1774034 /base/metrics/histogram.cc | |
parent | 5d2b449b4f0b3d13c75e540c834c550ed38c0912 (diff) | |
download | chromium_src-141ba0fbc6d11e6b2d4e7411d266037d1bac11cf.zip chromium_src-141ba0fbc6d11e6b2d4e7411d266037d1bac11cf.tar.gz chromium_src-141ba0fbc6d11e6b2d4e7411d266037d1bac11cf.tar.bz2 |
Small cleanup for previous histogram checkin
CL http://codereview.chromium.org/6577013/ had
a few changes suggested that were not incorporated.
This CL has those name changes etc.
r=rvargas
Review URL: http://codereview.chromium.org/6591052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/metrics/histogram.cc')
-rw-r--r-- | base/metrics/histogram.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 2d16582..c8d7b5f 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc @@ -86,7 +86,7 @@ scoped_refptr<Histogram> Histogram::FactoryGet(const std::string& name, 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 @@ Histogram::~Histogram() { 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 @@ void Histogram::InitializeBucketRange() { 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 @@ scoped_refptr<Histogram> LinearHistogram::FactoryGet(const std::string& name, 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 @@ scoped_refptr<Histogram> BooleanHistogram::FactoryGet(const std::string& name, 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 @@ scoped_refptr<Histogram> CustomHistogram::FactoryGet( 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 @@ bool StatisticsRecorder::IsActive() { // 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; |