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

Side by Side Diff: base/metrics/sample_vector.h

Issue 2853853002: Fix overflow when logging MaxInt32 to a sparse histogram. (Closed)
Patch Set: Address comments. Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « base/metrics/sample_map_unittest.cc ('k') | base/metrics/sample_vector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // SampleVector implements HistogramSamples interface. It is used by all 5 // SampleVector implements HistogramSamples interface. It is used by all
6 // Histogram based classes to store samples. 6 // Histogram based classes to store samples.
7 7
8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_ 8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_
9 #define BASE_METRICS_SAMPLE_VECTOR_H_ 9 #define BASE_METRICS_SAMPLE_VECTOR_H_
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 const BucketRanges* bucket_ranges); 155 const BucketRanges* bucket_ranges);
156 SampleVectorIterator(const HistogramBase::AtomicCount* counts, 156 SampleVectorIterator(const HistogramBase::AtomicCount* counts,
157 size_t counts_size, 157 size_t counts_size,
158 const BucketRanges* bucket_ranges); 158 const BucketRanges* bucket_ranges);
159 ~SampleVectorIterator() override; 159 ~SampleVectorIterator() override;
160 160
161 // SampleCountIterator implementation: 161 // SampleCountIterator implementation:
162 bool Done() const override; 162 bool Done() const override;
163 void Next() override; 163 void Next() override;
164 void Get(HistogramBase::Sample* min, 164 void Get(HistogramBase::Sample* min,
165 HistogramBase::Sample* max, 165 int64_t* max,
166 HistogramBase::Count* count) const override; 166 HistogramBase::Count* count) const override;
167 167
168 // SampleVector uses predefined buckets, so iterator can return bucket index. 168 // SampleVector uses predefined buckets, so iterator can return bucket index.
169 bool GetBucketIndex(size_t* index) const override; 169 bool GetBucketIndex(size_t* index) const override;
170 170
171 private: 171 private:
172 void SkipEmptyBuckets(); 172 void SkipEmptyBuckets();
173 173
174 const HistogramBase::AtomicCount* counts_; 174 const HistogramBase::AtomicCount* counts_;
175 size_t counts_size_; 175 size_t counts_size_;
176 const BucketRanges* bucket_ranges_; 176 const BucketRanges* bucket_ranges_;
177 177
178 size_t index_; 178 size_t index_;
179 }; 179 };
180 180
181 } // namespace base 181 } // namespace base
182 182
183 #endif // BASE_METRICS_SAMPLE_VECTOR_H_ 183 #endif // BASE_METRICS_SAMPLE_VECTOR_H_
OLDNEW
« no previous file with comments | « base/metrics/sample_map_unittest.cc ('k') | base/metrics/sample_vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698