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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 //---------------------------------------------------------------------------- | 848 //---------------------------------------------------------------------------- |
849 size_t size() const { return ranges_.size(); } | 849 size_t size() const { return ranges_.size(); } |
850 Histogram::Sample ranges(size_t i) const { return ranges_[i]; } | 850 Histogram::Sample ranges(size_t i) const { return ranges_[i]; } |
851 void SetBucketRange(size_t i, Histogram::Sample value); | 851 void SetBucketRange(size_t i, Histogram::Sample value); |
852 uint32 range_checksum(uint32 checksum) const { return range_checksum_; } | 852 uint32 range_checksum(uint32 checksum) const { return range_checksum_; } |
853 void SetRangeChecksum(uint32 checksum) { range_checksum_ = checksum; } | 853 void SetRangeChecksum(uint32 checksum) { range_checksum_ = checksum; } |
854 | 854 |
855 // Return true iff |other| object has same ranges_ as |this| object's ranges_. | 855 // Return true iff |other| object has same ranges_ as |this| object's ranges_. |
856 bool Equals(CachedRanges* other) const; | 856 bool Equals(CachedRanges* other) const; |
857 | 857 |
| 858 bool Serialize(Pickle* pickle) const; |
| 859 bool Deserialize(void** iter, const Pickle& pickle); |
| 860 |
858 private: | 861 private: |
859 // Allow tests to corrupt our innards for testing purposes. | 862 // Allow tests to corrupt our innards for testing purposes. |
860 FRIEND_TEST(HistogramTest, CorruptBucketBounds); | 863 FRIEND_TEST(HistogramTest, CorruptBucketBounds); |
861 | 864 |
862 // A monotonically increasing list of values which determine which bucket to | 865 // A monotonically increasing list of values which determine which bucket to |
863 // put a sample into. For each index, show the smallest sample that can be | 866 // put a sample into. For each index, show the smallest sample that can be |
864 // added to the corresponding bucket. | 867 // added to the corresponding bucket. |
865 Ranges ranges_; | 868 Ranges ranges_; |
866 | 869 |
867 // Checksum for the conntents of ranges_. Used to detect random over-writes | 870 // Checksum for the conntents of ranges_. Used to detect random over-writes |
868 // of our data, and to quickly see if some other CachedRanges instance is | 871 // of our data, and to quickly see if some other CachedRanges instance is |
869 // possibly Equal() to this instance. | 872 // possibly Equal() to this instance. |
870 uint32 range_checksum_; | 873 uint32 range_checksum_; |
871 | 874 |
872 DISALLOW_COPY_AND_ASSIGN(CachedRanges); | 875 DISALLOW_COPY_AND_ASSIGN(CachedRanges); |
873 }; | 876 }; |
874 | 877 |
875 } // namespace base | 878 } // namespace base |
876 | 879 |
877 #endif // BASE_METRICS_HISTOGRAM_H_ | 880 #endif // BASE_METRICS_HISTOGRAM_H_ |
OLD | NEW |