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 // StatisticsRecorder holds all Histograms and BucketRanges that are used by | 5 // StatisticsRecorder holds all Histograms and BucketRanges that are used by |
6 // Histograms in the system. It provides a general place for | 6 // Histograms in the system. It provides a general place for |
7 // Histograms/BucketRanges to register, and supports a global API for accessing | 7 // Histograms/BucketRanges to register, and supports a global API for accessing |
8 // (i.e., dumping, or graphing) the data. | 8 // (i.e., dumping, or graphing) the data. |
9 | 9 |
10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ | 10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // We keep all |bucket_ranges_| in a map, from checksum to a list of | 78 // We keep all |bucket_ranges_| in a map, from checksum to a list of |
79 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in | 79 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in |
80 // |bucket_ranges_|. | 80 // |bucket_ranges_|. |
81 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; | 81 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; |
82 | 82 |
83 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; | 83 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; |
84 friend class HistogramBaseTest; | 84 friend class HistogramBaseTest; |
85 friend class HistogramTest; | 85 friend class HistogramTest; |
86 friend class SparseHistogramTest; | 86 friend class SparseHistogramTest; |
87 friend class StatisticsRecorderTest; | 87 friend class StatisticsRecorderTest; |
| 88 FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest, |
| 89 DeserializeHistogramAndAddSamples); |
88 | 90 |
89 // The constructor just initializes static members. Usually client code should | 91 // The constructor just initializes static members. Usually client code should |
90 // use Initialize to do this. But in test code, you can friend this class and | 92 // use Initialize to do this. But in test code, you can friend this class and |
91 // call destructor/constructor to get a clean StatisticsRecorder. | 93 // call destructor/constructor to get a clean StatisticsRecorder. |
92 StatisticsRecorder(); | 94 StatisticsRecorder(); |
93 ~StatisticsRecorder(); | 95 ~StatisticsRecorder(); |
94 | 96 |
95 static void DumpHistogramsToVlog(void* instance); | 97 static void DumpHistogramsToVlog(void* instance); |
96 | 98 |
97 static HistogramMap* histograms_; | 99 static HistogramMap* histograms_; |
98 static RangesMap* ranges_; | 100 static RangesMap* ranges_; |
99 | 101 |
100 // Lock protects access to above maps. | 102 // Lock protects access to above maps. |
101 static base::Lock* lock_; | 103 static base::Lock* lock_; |
102 | 104 |
103 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 105 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
104 }; | 106 }; |
105 | 107 |
106 } // namespace base | 108 } // namespace base |
107 | 109 |
108 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ | 110 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ |
OLD | NEW |