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

Unified Diff: base/metrics/sample_vector.cc

Issue 17451016: [UMA] Remove redundant bucket_count variable from base::Histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename variables to be clearer Created 7 years, 6 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_unittest.cc ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/sample_vector.cc
diff --git a/base/metrics/sample_vector.cc b/base/metrics/sample_vector.cc
index 8f1451035ecce1a97acd9dd60d50e5a39e033554..fe602eec80907e5f13bf3299ba003a1994d6c1aa 100644
--- a/base/metrics/sample_vector.cc
+++ b/base/metrics/sample_vector.cc
@@ -15,9 +15,9 @@ typedef HistogramBase::Count Count;
typedef HistogramBase::Sample Sample;
SampleVector::SampleVector(const BucketRanges* bucket_ranges)
- : counts_(bucket_ranges->size() - 1),
+ : counts_(bucket_ranges->bucket_count()),
bucket_ranges_(bucket_ranges) {
- CHECK_GE(bucket_ranges_->size(), 2u);
+ CHECK_GE(bucket_ranges_->bucket_count(), 1u);
}
SampleVector::~SampleVector() {}
@@ -83,7 +83,7 @@ bool SampleVector::AddSubtractImpl(SampleCountIterator* iter,
// Use simple binary search. This is very general, but there are better
// approaches if we knew that the buckets were linearly distributed.
size_t SampleVector::GetBucketIndex(Sample value) const {
- size_t bucket_count = bucket_ranges_->size() - 1;
+ size_t bucket_count = bucket_ranges_->bucket_count();
CHECK_GE(bucket_count, 1u);
CHECK_GE(value, bucket_ranges_->range(0));
CHECK_LT(value, bucket_ranges_->range(bucket_count));
@@ -112,7 +112,7 @@ SampleVectorIterator::SampleVectorIterator(const vector<Count>* counts,
: counts_(counts),
bucket_ranges_(bucket_ranges),
index_(0) {
- CHECK_GT(bucket_ranges_->size(), counts_->size());
+ CHECK_GE(bucket_ranges_->bucket_count(), counts_->size());
SkipEmptyBuckets();
}
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698