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

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

Issue 1689833002: Add ownership-transfer to histogram management calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/metrics/histogram.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 class PickleIterator; 97 class PickleIterator;
98 class SampleVector; 98 class SampleVector;
99 99
100 class BASE_EXPORT Histogram : public HistogramBase { 100 class BASE_EXPORT Histogram : public HistogramBase {
101 public: 101 public:
102 // Initialize maximum number of buckets in histograms as 16,384. 102 // Initialize maximum number of buckets in histograms as 16,384.
103 static const uint32_t kBucketCount_MAX; 103 static const uint32_t kBucketCount_MAX;
104 104
105 typedef std::vector<Count> Counts; 105 typedef std::vector<Count> Counts;
106 106
107 ~Histogram() override;
108
107 //---------------------------------------------------------------------------- 109 //----------------------------------------------------------------------------
108 // For a valid histogram, input should follow these restrictions: 110 // For a valid histogram, input should follow these restrictions:
109 // minimum > 0 (if a minimum below 1 is specified, it will implicitly be 111 // minimum > 0 (if a minimum below 1 is specified, it will implicitly be
110 // normalized up to 1) 112 // normalized up to 1)
111 // maximum > minimum 113 // maximum > minimum
112 // buckets > 2 [minimum buckets needed: underflow, overflow and the range] 114 // buckets > 2 [minimum buckets needed: underflow, overflow and the range]
113 // Additionally, 115 // Additionally,
114 // buckets <= (maximum - minimum + 2) - this is to ensure that we don't have 116 // buckets <= (maximum - minimum + 2) - this is to ensure that we don't have
115 // more buckets than the range of numbers; having more buckets than 1 per 117 // more buckets than the range of numbers; having more buckets than 1 per
116 // value in the range would be nonsensical. 118 // value in the range would be nonsensical.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 Histogram(const std::string& name, 232 Histogram(const std::string& name,
231 Sample minimum, 233 Sample minimum,
232 Sample maximum, 234 Sample maximum,
233 const BucketRanges* ranges, 235 const BucketRanges* ranges,
234 HistogramBase::AtomicCount* counts, 236 HistogramBase::AtomicCount* counts,
235 HistogramBase::AtomicCount* logged_counts, 237 HistogramBase::AtomicCount* logged_counts,
236 uint32_t counts_size, 238 uint32_t counts_size,
237 HistogramSamples::Metadata* meta, 239 HistogramSamples::Metadata* meta,
238 HistogramSamples::Metadata* logged_meta); 240 HistogramSamples::Metadata* logged_meta);
239 241
240 ~Histogram() override;
241
242 // HistogramBase implementation: 242 // HistogramBase implementation:
243 bool SerializeInfoImpl(base::Pickle* pickle) const override; 243 bool SerializeInfoImpl(base::Pickle* pickle) const override;
244 244
245 // Method to override to skip the display of the i'th bucket if it's empty. 245 // Method to override to skip the display of the i'th bucket if it's empty.
246 virtual bool PrintEmptyBucket(uint32_t index) const; 246 virtual bool PrintEmptyBucket(uint32_t index) const;
247 247
248 // Get normalized size, relative to the ranges(i). 248 // Get normalized size, relative to the ranges(i).
249 virtual double GetBucketSize(Count current, uint32_t i) const; 249 virtual double GetBucketSize(Count current, uint32_t i) const;
250 250
251 // Return a string description of what goes in a given bucket. 251 // Return a string description of what goes in a given bucket.
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); 534 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
535 535
536 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); 536 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges);
537 537
538 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); 538 DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
539 }; 539 };
540 540
541 } // namespace base 541 } // namespace base
542 542
543 #endif // BASE_METRICS_HISTOGRAM_H_ 543 #endif // BASE_METRICS_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698