| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 // ClearCallback clears any callback set on the histogram referred to by | 124 // ClearCallback clears any callback set on the histogram referred to by |
| 125 // |histogram_name|. This method is thread safe. | 125 // |histogram_name|. This method is thread safe. |
| 126 static void ClearCallback(const std::string& histogram_name); | 126 static void ClearCallback(const std::string& histogram_name); |
| 127 | 127 |
| 128 // FindCallback retrieves the callback for the histogram referred to by | 128 // FindCallback retrieves the callback for the histogram referred to by |
| 129 // |histogram_name|, or a null callback if no callback exists for this | 129 // |histogram_name|, or a null callback if no callback exists for this |
| 130 // histogram. This method is thread safe. | 130 // histogram. This method is thread safe. |
| 131 static OnSampleCallback FindCallback(const std::string& histogram_name); | 131 static OnSampleCallback FindCallback(const std::string& histogram_name); |
| 132 | 132 |
| 133 // Returns the number of known histograms. |
| 134 static size_t NumberOfHistograms(); |
| 135 |
| 133 // Clears all of the known histograms and resets static variables to a | 136 // Clears all of the known histograms and resets static variables to a |
| 134 // state that allows a new initialization. | 137 // state that allows a new initialization. |
| 135 static void ResetForTesting(); | 138 static void ResetForTesting(); |
| 136 | 139 |
| 137 // Removes a histogram from the internal set of known ones. This can be | 140 // Removes a histogram from the internal set of known ones. This can be |
| 138 // necessary during testing persistent histograms where the underlying | 141 // necessary during testing persistent histograms where the underlying |
| 139 // memory is being released. | 142 // memory is being released. |
| 140 static void ForgetHistogramForTesting(base::StringPiece name); | 143 static void ForgetHistogramForTesting(base::StringPiece name); |
| 141 | 144 |
| 142 private: | 145 private: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 178 |
| 176 // Lock protects access to above maps. | 179 // Lock protects access to above maps. |
| 177 static base::Lock* lock_; | 180 static base::Lock* lock_; |
| 178 | 181 |
| 179 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); | 182 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); |
| 180 }; | 183 }; |
| 181 | 184 |
| 182 } // namespace base | 185 } // namespace base |
| 183 | 186 |
| 184 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ | 187 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ |
| OLD | NEW |