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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts); | 258 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts); |
259 | 259 |
260 friend class StatisticsRecorder; // To allow it to delete duplicates. | 260 friend class StatisticsRecorder; // To allow it to delete duplicates. |
261 friend class StatisticsRecorderTest; | 261 friend class StatisticsRecorderTest; |
262 | 262 |
263 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo( | 263 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo( |
264 base::PickleIterator* iter); | 264 base::PickleIterator* iter); |
265 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); | 265 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); |
266 | 266 |
267 // Implementation of SnapshotSamples function. | 267 // Implementation of SnapshotSamples function. |
268 std::unique_ptr<SampleVector> SnapshotSampleVector() const; | 268 std::unique_ptr<SampleVector> SnapshotSampleVector() const; |
Alexei Svitkine (slow)
2017/05/10 16:55:38
While you're here, probably worth renaming this an
altimin
2017/05/11 12:38:33
Done.
| |
269 | 269 |
270 // Create a copy of unlogged samples. | |
271 std::unique_ptr<SampleVector> SnapshotUnloggedSamples() const; | |
272 | |
270 //---------------------------------------------------------------------------- | 273 //---------------------------------------------------------------------------- |
271 // Helpers for emitting Ascii graphic. Each method appends data to output. | 274 // Helpers for emitting Ascii graphic. Each method appends data to output. |
272 | 275 |
273 void WriteAsciiImpl(bool graph_it, | 276 void WriteAsciiImpl(bool graph_it, |
274 const std::string& newline, | 277 const std::string& newline, |
275 std::string* output) const; | 278 std::string* output) const; |
276 | 279 |
277 // Find out how large (graphically) the largest bucket will appear to be. | 280 // Find out how large (graphically) the largest bucket will appear to be. |
278 double GetPeakBucketSize(const SampleVectorBase& samples) const; | 281 double GetPeakBucketSize(const SampleVectorBase& samples) const; |
279 | 282 |
(...skipping 16 matching lines...) Expand all Loading... | |
296 void GetCountAndBucketData(Count* count, | 299 void GetCountAndBucketData(Count* count, |
297 int64_t* sum, | 300 int64_t* sum, |
298 ListValue* buckets) const override; | 301 ListValue* buckets) const override; |
299 | 302 |
300 // Does not own this object. Should get from StatisticsRecorder. | 303 // Does not own this object. Should get from StatisticsRecorder. |
301 const BucketRanges* bucket_ranges_; | 304 const BucketRanges* bucket_ranges_; |
302 | 305 |
303 Sample declared_min_; // Less than this goes into the first bucket. | 306 Sample declared_min_; // Less than this goes into the first bucket. |
304 Sample declared_max_; // Over this goes into the last bucket. | 307 Sample declared_max_; // Over this goes into the last bucket. |
305 | 308 |
306 // Finally, provide the state that changes with the addition of each new | 309 // Samples that have not yet been logged with SnapshotDelta(). |
307 // sample. | 310 std::unique_ptr<HistogramSamples> unlogged_samples_; |
308 std::unique_ptr<SampleVectorBase> samples_; | |
309 | 311 |
310 // Also keep a previous uploaded state for calculating deltas. | 312 // Accumulation of all samples that have logged with SnapshotDelta(). |
Alexei Svitkine (slow)
2017/05/10 16:55:38
Nit: "that have been logged" or "that were logged"
altimin
2017/05/11 12:38:33
Done.
| |
311 std::unique_ptr<HistogramSamples> logged_samples_; | 313 std::unique_ptr<HistogramSamples> logged_samples_; |
312 | 314 |
313 // Flag to indicate if PrepareFinalDelta has been previously called. It is | 315 // Flag to indicate if PrepareFinalDelta has been previously called. It is |
314 // used to DCHECK that a final delta is not created multiple times. | 316 // used to DCHECK that a final delta is not created multiple times. |
315 mutable bool final_delta_created_ = false; | 317 mutable bool final_delta_created_ = false; |
316 | 318 |
317 DISALLOW_COPY_AND_ASSIGN(Histogram); | 319 DISALLOW_COPY_AND_ASSIGN(Histogram); |
318 }; | 320 }; |
319 | 321 |
320 //------------------------------------------------------------------------------ | 322 //------------------------------------------------------------------------------ |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); | 537 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); |
536 | 538 |
537 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); | 539 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); |
538 | 540 |
539 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); | 541 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); |
540 }; | 542 }; |
541 | 543 |
542 } // namespace base | 544 } // namespace base |
543 | 545 |
544 #endif // BASE_METRICS_HISTOGRAM_H_ | 546 #endif // BASE_METRICS_HISTOGRAM_H_ |
OLD | NEW |