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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 HistogramType GetHistogramType() const override; | 199 HistogramType GetHistogramType() const override; |
200 bool HasConstructionArguments(Sample expected_minimum, | 200 bool HasConstructionArguments(Sample expected_minimum, |
201 Sample expected_maximum, | 201 Sample expected_maximum, |
202 uint32_t expected_bucket_count) const override; | 202 uint32_t expected_bucket_count) const override; |
203 void Add(Sample value) override; | 203 void Add(Sample value) override; |
204 void AddCount(Sample value, int count) override; | 204 void AddCount(Sample value, int count) override; |
205 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; | 205 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; |
206 std::unique_ptr<HistogramSamples> SnapshotDelta() override; | 206 std::unique_ptr<HistogramSamples> SnapshotDelta() override; |
207 void AddSamples(const HistogramSamples& samples) override; | 207 void AddSamples(const HistogramSamples& samples) override; |
208 bool AddSamplesFromPickle(base::PickleIterator* iter) override; | 208 bool AddSamplesFromPickle(base::PickleIterator* iter) override; |
209 void WriteHTMLGraph(std::string* output) const override; | 209 void WriteHTMLGraph(const HistogramSamples* snapshot, |
210 void WriteAscii(std::string* output) const override; | 210 std::string* output) const override; |
| 211 void WriteAscii(const HistogramSamples* snapshot, |
| 212 std::string* output) const override; |
211 | 213 |
212 protected: | 214 protected: |
213 // This class, defined entirely within the .cc file, contains all the | 215 // This class, defined entirely within the .cc file, contains all the |
214 // common logic for building a Histogram and can be overridden by more | 216 // common logic for building a Histogram and can be overridden by more |
215 // specific types to alter details of how the creation is done. It is | 217 // specific types to alter details of how the creation is done. It is |
216 // defined as an embedded class (rather than an anonymous one) so it | 218 // defined as an embedded class (rather than an anonymous one) so it |
217 // can access the protected constructors. | 219 // can access the protected constructors. |
218 class Factory; | 220 class Factory; |
219 | 221 |
220 // |ranges| should contain the underflow and overflow buckets. See top | 222 // |ranges| should contain the underflow and overflow buckets. See top |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); | 270 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); |
269 | 271 |
270 // Implementation of SnapshotSamples function. | 272 // Implementation of SnapshotSamples function. |
271 std::unique_ptr<SampleVector> SnapshotSampleVector() const; | 273 std::unique_ptr<SampleVector> SnapshotSampleVector() const; |
272 | 274 |
273 //---------------------------------------------------------------------------- | 275 //---------------------------------------------------------------------------- |
274 // Helpers for emitting Ascii graphic. Each method appends data to output. | 276 // Helpers for emitting Ascii graphic. Each method appends data to output. |
275 | 277 |
276 void WriteAsciiImpl(bool graph_it, | 278 void WriteAsciiImpl(bool graph_it, |
277 const std::string& newline, | 279 const std::string& newline, |
| 280 const SampleVector* snapshot, |
278 std::string* output) const; | 281 std::string* output) const; |
279 | 282 |
280 // Find out how large (graphically) the largest bucket will appear to be. | 283 // Find out how large (graphically) the largest bucket will appear to be. |
281 double GetPeakBucketSize(const SampleVector& samples) const; | 284 double GetPeakBucketSize(const SampleVector& samples) const; |
282 | 285 |
283 // Write a common header message describing this histogram. | 286 // Write a common header message describing this histogram. |
284 void WriteAsciiHeader(const SampleVector& samples, | 287 void WriteAsciiHeader(const SampleVector& samples, |
285 Count sample_count, | 288 Count sample_count, |
286 std::string* output) const; | 289 std::string* output) const; |
287 | 290 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); | 541 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); |
539 | 542 |
540 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); | 543 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); |
541 | 544 |
542 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); | 545 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); |
543 }; | 546 }; |
544 | 547 |
545 } // namespace base | 548 } // namespace base |
546 | 549 |
547 #endif // BASE_METRICS_HISTOGRAM_H_ | 550 #endif // BASE_METRICS_HISTOGRAM_H_ |
OLD | NEW |