OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 // samples we've accumulated into all of our buckets. We can compare this | 423 // samples we've accumulated into all of our buckets. We can compare this |
424 // count to the sum of the counts in all buckets, and detect problems. Note | 424 // count to the sum of the counts in all buckets, and detect problems. Note |
425 // that due to races in histogram accumulation (if a histogram is indeed | 425 // that due to races in histogram accumulation (if a histogram is indeed |
426 // updated on several threads simultaneously), the tallies might mismatch, | 426 // updated on several threads simultaneously), the tallies might mismatch, |
427 // and also the snapshotting code may asynchronously get a mismatch (though | 427 // and also the snapshotting code may asynchronously get a mismatch (though |
428 // generally either race based mismatch cause is VERY rare). | 428 // generally either race based mismatch cause is VERY rare). |
429 int64 redundant_count_; | 429 int64 redundant_count_; |
430 }; | 430 }; |
431 | 431 |
432 //---------------------------------------------------------------------------- | 432 //---------------------------------------------------------------------------- |
433 // minimum should start from 1. 0 is invalid as a minimum. 0 is an implicit | 433 // For a valid histogram, input should follow these restrictions: |
434 // default underflow bucket. | 434 // minimum > 0 |
jar (doing other things)
2012/01/05 17:35:14
There is fixup code in histograms for this, so min
rkc
2012/01/06 00:08:01
Done.
| |
435 // maximum > minimum | |
436 // buckets > 2 [minimum buckets needed: underflow, overflow and the range] | |
437 // Additionally, | |
438 // buckets <= (maximum - minimum + 2) - this is to ensure that we don't have | |
439 // more buckets than the range of numbers; having more buckets than 1 per | |
440 // value in the range would be nonsensical. | |
435 static Histogram* FactoryGet(const std::string& name, | 441 static Histogram* FactoryGet(const std::string& name, |
436 Sample minimum, | 442 Sample minimum, |
437 Sample maximum, | 443 Sample maximum, |
438 size_t bucket_count, | 444 size_t bucket_count, |
439 Flags flags); | 445 Flags flags); |
440 static Histogram* FactoryTimeGet(const std::string& name, | 446 static Histogram* FactoryTimeGet(const std::string& name, |
441 base::TimeDelta minimum, | 447 base::TimeDelta minimum, |
442 base::TimeDelta maximum, | 448 base::TimeDelta maximum, |
443 size_t bucket_count, | 449 size_t bucket_count, |
444 Flags flags); | 450 Flags flags); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
885 // of our data, and to quickly see if some other CachedRanges instance is | 891 // of our data, and to quickly see if some other CachedRanges instance is |
886 // possibly Equal() to this instance. | 892 // possibly Equal() to this instance. |
887 uint32 range_checksum_; | 893 uint32 range_checksum_; |
888 | 894 |
889 DISALLOW_COPY_AND_ASSIGN(CachedRanges); | 895 DISALLOW_COPY_AND_ASSIGN(CachedRanges); |
890 }; | 896 }; |
891 | 897 |
892 } // namespace base | 898 } // namespace base |
893 | 899 |
894 #endif // BASE_METRICS_HISTOGRAM_H_ | 900 #endif // BASE_METRICS_HISTOGRAM_H_ |
OLD | NEW |