| OLD | NEW |
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Note. Currently it allow some bad input, e.g. 0 as minimum, but silently | 169 // Note. Currently it allow some bad input, e.g. 0 as minimum, but silently |
| 170 // converts it to good input: 1. | 170 // converts it to good input: 1. |
| 171 // TODO(kaiwang): Be more restrict and return false for any bad input, and | 171 // TODO(kaiwang): Be more restrict and return false for any bad input, and |
| 172 // make this a readonly validating function. | 172 // make this a readonly validating function. |
| 173 static bool InspectConstructionArguments(const std::string& name, | 173 static bool InspectConstructionArguments(const std::string& name, |
| 174 Sample* minimum, | 174 Sample* minimum, |
| 175 Sample* maximum, | 175 Sample* maximum, |
| 176 size_t* bucket_count); | 176 size_t* bucket_count); |
| 177 | 177 |
| 178 // HistogramBase implementation: | 178 // HistogramBase implementation: |
| 179 uint64_t name_hash() const override; |
| 179 HistogramType GetHistogramType() const override; | 180 HistogramType GetHistogramType() const override; |
| 180 bool HasConstructionArguments(Sample expected_minimum, | 181 bool HasConstructionArguments(Sample expected_minimum, |
| 181 Sample expected_maximum, | 182 Sample expected_maximum, |
| 182 size_t expected_bucket_count) const override; | 183 size_t expected_bucket_count) const override; |
| 183 void Add(Sample value) override; | 184 void Add(Sample value) override; |
| 184 void AddCount(Sample value, int count) override; | 185 void AddCount(Sample value, int count) override; |
| 185 scoped_ptr<HistogramSamples> SnapshotSamples() const override; | 186 scoped_ptr<HistogramSamples> SnapshotSamples() const override; |
| 186 void AddSamples(const HistogramSamples& samples) override; | 187 void AddSamples(const HistogramSamples& samples) override; |
| 187 bool AddSamplesFromPickle(base::PickleIterator* iter) override; | 188 bool AddSamplesFromPickle(base::PickleIterator* iter) override; |
| 188 void WriteHTMLGraph(std::string* output) const override; | 189 void WriteHTMLGraph(std::string* output) const override; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); | 435 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); |
| 435 static BucketRanges* CreateBucketRangesFromCustomRanges( | 436 static BucketRanges* CreateBucketRangesFromCustomRanges( |
| 436 const std::vector<Sample>& custom_ranges); | 437 const std::vector<Sample>& custom_ranges); |
| 437 | 438 |
| 438 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); | 439 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); |
| 439 }; | 440 }; |
| 440 | 441 |
| 441 } // namespace base | 442 } // namespace base |
| 442 | 443 |
| 443 #endif // BASE_METRICS_HISTOGRAM_H_ | 444 #endif // BASE_METRICS_HISTOGRAM_H_ |
| OLD | NEW |