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

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

Issue 1618423004: Fix overflow bug in histogram sample data structures (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rename tests, remove redundant comments. Created 4 years, 11 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 | « no previous file | base/metrics/histogram_unittest.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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 8
9 // It supports calls to accumulate either time intervals (which are processed 9 // It supports calls to accumulate either time intervals (which are processed
10 // as integral number of milliseconds), or arbitrary integral units. 10 // as integral number of milliseconds), or arbitrary integral units.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 // Return a string description of what goes in a given bucket. 214 // Return a string description of what goes in a given bucket.
215 // Most commonly this is the numeric value, but in derived classes it may 215 // Most commonly this is the numeric value, but in derived classes it may
216 // be a name (or string description) given to the bucket. 216 // be a name (or string description) given to the bucket.
217 virtual const std::string GetAsciiBucketRange(size_t it) const; 217 virtual const std::string GetAsciiBucketRange(size_t it) const;
218 218
219 private: 219 private:
220 // Allow tests to corrupt our innards for testing purposes. 220 // Allow tests to corrupt our innards for testing purposes.
221 FRIEND_TEST_ALL_PREFIXES(HistogramTest, BoundsTest); 221 FRIEND_TEST_ALL_PREFIXES(HistogramTest, BoundsTest);
222 FRIEND_TEST_ALL_PREFIXES(HistogramTest, BucketPlacementTest); 222 FRIEND_TEST_ALL_PREFIXES(HistogramTest, BucketPlacementTest);
223 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptBucketBounds);
224 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts); 223 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts);
225 FRIEND_TEST_ALL_PREFIXES(HistogramTest, NameMatchTest);
226 FRIEND_TEST_ALL_PREFIXES(HistogramTest, AddCountTest);
227 224
228 friend class StatisticsRecorder; // To allow it to delete duplicates. 225 friend class StatisticsRecorder; // To allow it to delete duplicates.
229 friend class StatisticsRecorderTest; 226 friend class StatisticsRecorderTest;
230 227
231 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo( 228 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
232 base::PickleIterator* iter); 229 base::PickleIterator* iter);
233 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); 230 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
234 231
235 // Implementation of SnapshotSamples function. 232 // Implementation of SnapshotSamples function.
236 scoped_ptr<SampleVector> SnapshotSampleVector() const; 233 scoped_ptr<SampleVector> SnapshotSampleVector() const;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); 437 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges);
441 static BucketRanges* CreateBucketRangesFromCustomRanges( 438 static BucketRanges* CreateBucketRangesFromCustomRanges(
442 const std::vector<Sample>& custom_ranges); 439 const std::vector<Sample>& custom_ranges);
443 440
444 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); 441 DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
445 }; 442 };
446 443
447 } // namespace base 444 } // namespace base
448 445
449 #endif // BASE_METRICS_HISTOGRAM_H_ 446 #endif // BASE_METRICS_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698