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 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ |
6 #define BASE_METRICS_HISTOGRAM_BASE_H_ | 6 #define BASE_METRICS_HISTOGRAM_BASE_H_ |
7 | 7 |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // Snapshot the current complete set of sample data. | 196 // Snapshot the current complete set of sample data. |
197 // Override with atomic/locked snapshot if needed. | 197 // Override with atomic/locked snapshot if needed. |
198 virtual std::unique_ptr<HistogramSamples> SnapshotSamples() const = 0; | 198 virtual std::unique_ptr<HistogramSamples> SnapshotSamples() const = 0; |
199 | 199 |
200 // Calculate the change (delta) in histogram counts since the previous call | 200 // Calculate the change (delta) in histogram counts since the previous call |
201 // to this method. Each successive call will return only those counts | 201 // to this method. Each successive call will return only those counts |
202 // changed since the last call. | 202 // changed since the last call. |
203 virtual std::unique_ptr<HistogramSamples> SnapshotDelta() = 0; | 203 virtual std::unique_ptr<HistogramSamples> SnapshotDelta() = 0; |
204 | 204 |
205 // The following methods provide graphical histogram displays. | 205 // The following methods provide graphical histogram displays. The snapshot |
206 virtual void WriteHTMLGraph(std::string* output) const = 0; | 206 // must be for this histogram or the results are undefined. If the passed |
207 virtual void WriteAscii(std::string* output) const = 0; | 207 // |snapshot| is null, one will be taken of the internal data. |
| 208 virtual void WriteHTMLGraph(const HistogramSamples* snapshot, |
| 209 std::string* output) const = 0; |
| 210 virtual void WriteAscii(const HistogramSamples* snapshot, |
| 211 std::string* output) const = 0; |
208 | 212 |
209 // Produce a JSON representation of the histogram. This is implemented with | 213 // Produce a JSON representation of the histogram. This is implemented with |
210 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 214 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
211 // customize the output. | 215 // customize the output. |
212 void WriteJSON(std::string* output) const; | 216 void WriteJSON(std::string* output) const; |
213 | 217 |
214 // This enables a histogram that reports the what types of histograms are | 218 // This enables a histogram that reports the what types of histograms are |
215 // created and their flags. It must be called while still single-threaded. | 219 // created and their flags. It must be called while still single-threaded. |
216 // | 220 // |
217 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml | 221 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 269 |
266 const std::string histogram_name_; | 270 const std::string histogram_name_; |
267 AtomicCount flags_; | 271 AtomicCount flags_; |
268 | 272 |
269 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 273 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
270 }; | 274 }; |
271 | 275 |
272 } // namespace base | 276 } // namespace base |
273 | 277 |
274 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 278 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |