Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1079)

Unified Diff: base/metrics/histogram.cc

Issue 6591052: Small cleanup for previous histogram checkin... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/histogram.h ('k') | net/disk_cache/stats_histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « base/metrics/histogram.h ('k') | net/disk_cache/stats_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698