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 70 matching lines...) Loading... |
81 | 81 |
82 // We keep all |bucket_ranges_| in a map, from checksum to a list of | 82 // We keep all |bucket_ranges_| in a map, from checksum to a list of |
83 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in | 83 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in |
84 // |bucket_ranges_|. | 84 // |bucket_ranges_|. |
85 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; | 85 typedef std::map<uint32, std::list<const BucketRanges*>*> RangesMap; |
86 | 86 |
87 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; | 87 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; |
88 friend class HistogramBaseTest; | 88 friend class HistogramBaseTest; |
89 friend class HistogramSnapshotManagerTest; | 89 friend class HistogramSnapshotManagerTest; |
90 friend class HistogramTest; | 90 friend class HistogramTest; |
| 91 friend class JsonPrefStoreTest; |
91 friend class SparseHistogramTest; | 92 friend class SparseHistogramTest; |
92 friend class StatisticsRecorderTest; | 93 friend class StatisticsRecorderTest; |
93 FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest, | 94 FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest, |
94 DeserializeHistogramAndAddSamples); | 95 DeserializeHistogramAndAddSamples); |
95 | 96 |
96 // The constructor just initializes static members. Usually client code should | 97 // The constructor just initializes static members. Usually client code should |
97 // use Initialize to do this. But in test code, you can friend this class and | 98 // use Initialize to do this. But in test code, you can friend this class and |
98 // call destructor/constructor to get a clean StatisticsRecorder. | 99 // call destructor/constructor to get a clean StatisticsRecorder. |
99 StatisticsRecorder(); | 100 StatisticsRecorder(); |
100 ~StatisticsRecorder(); | 101 ~StatisticsRecorder(); |
101 | 102 |
102 static void DumpHistogramsToVlog(void* instance); | 103 static void DumpHistogramsToVlog(void* instance); |
103 | 104 |
104 static HistogramMap* histograms_; | 105 static HistogramMap* histograms_; |
105 static RangesMap* ranges_; | 106 static RangesMap* ranges_; |
106 | 107 |
107 // Lock protects access to above maps. | 108 // Lock protects access to above maps. |
108 static base::Lock* lock_; | 109 static base::Lock* lock_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 111 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace base | 114 } // namespace base |
114 | 115 |
115 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ | 116 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ |
OLD | NEW |