Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: base/metrics/statistics_recorder.h

Issue 1485763002: Merge multiple histogram snapshots into single one for reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: Change 'inconsistencies' from int to unsigned. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 // ClearCallback clears any callback set on the histogram referred to by 123 // ClearCallback clears any callback set on the histogram referred to by
124 // |histogram_name|. This method is thread safe. 124 // |histogram_name|. This method is thread safe.
125 static void ClearCallback(const std::string& histogram_name); 125 static void ClearCallback(const std::string& histogram_name);
126 126
127 // FindCallback retrieves the callback for the histogram referred to by 127 // FindCallback retrieves the callback for the histogram referred to by
128 // |histogram_name|, or a null callback if no callback exists for this 128 // |histogram_name|, or a null callback if no callback exists for this
129 // histogram. This method is thread safe. 129 // histogram. This method is thread safe.
130 static OnSampleCallback FindCallback(const std::string& histogram_name); 130 static OnSampleCallback FindCallback(const std::string& histogram_name);
131 131
132 // Clears all of the known histograms and resets static variables to a
133 // state that allows a new initialization.
134 static void ResetForTesting();
135
132 private: 136 private:
133 // We keep a map of callbacks to histograms, so that as histograms are 137 // We keep a map of callbacks to histograms, so that as histograms are
134 // created, we can set the callback properly. 138 // created, we can set the callback properly.
135 typedef std::map<std::string, OnSampleCallback> CallbackMap; 139 typedef std::map<std::string, OnSampleCallback> CallbackMap;
136 140
137 // We keep all |bucket_ranges_| in a map, from checksum to a list of 141 // We keep all |bucket_ranges_| in a map, from checksum to a list of
138 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in 142 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in
139 // |bucket_ranges_|. 143 // |bucket_ranges_|.
140 typedef std::map<uint32_t, std::list<const BucketRanges*>*> RangesMap; 144 typedef std::map<uint32_t, std::list<const BucketRanges*>*> RangesMap;
141 145
(...skipping 22 matching lines...) Expand all
164 168
165 // Lock protects access to above maps. 169 // Lock protects access to above maps.
166 static base::Lock* lock_; 170 static base::Lock* lock_;
167 171
168 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 172 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
169 }; 173 };
170 174
171 } // namespace base 175 } // namespace base
172 176
173 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ 177 #endif // BASE_METRICS_STATISTICS_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698