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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 // Calculate the change (delta) in histogram counts since the previous call | 205 // Calculate the change (delta) in histogram counts since the previous call |
206 // to SnapshotDelta() but do so without modifying any internal data as to | 206 // to SnapshotDelta() but do so without modifying any internal data as to |
207 // what was previous logged. After such a call, no further calls to this | 207 // what was previous logged. After such a call, no further calls to this |
208 // method or to SnapshotDelta() should be done as the result would include | 208 // method or to SnapshotDelta() should be done as the result would include |
209 // data previously returned. Because no internal data is changed, this call | 209 // data previously returned. Because no internal data is changed, this call |
210 // can be made on "const" histograms such as those with data held in | 210 // can be made on "const" histograms such as those with data held in |
211 // read-only memory. | 211 // read-only memory. |
212 virtual std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const = 0; | 212 virtual std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const = 0; |
213 | 213 |
214 // The following methods provide graphical histogram displays. | 214 // The following methods provide graphical histogram displays. The snapshot |
215 virtual void WriteHTMLGraph(std::string* output) const = 0; | 215 // must be for this histogram or the results are undefined. If the passed |
216 virtual void WriteAscii(std::string* output) const = 0; | 216 // |snapshot| is null, one will be taken of the internal data. |
| 217 virtual void WriteHTMLGraph(const HistogramSamples* snapshot, |
| 218 std::string* output) const = 0; |
| 219 virtual void WriteAscii(const HistogramSamples* snapshot, |
| 220 std::string* output) const = 0; |
217 | 221 |
218 // Produce a JSON representation of the histogram. This is implemented with | 222 // Produce a JSON representation of the histogram. This is implemented with |
219 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 223 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
220 // customize the output. | 224 // customize the output. |
221 void WriteJSON(std::string* output) const; | 225 void WriteJSON(std::string* output) const; |
222 | 226 |
223 // This enables a histogram that reports the what types of histograms are | 227 // This enables a histogram that reports the what types of histograms are |
224 // created and their flags. It must be called while still single-threaded. | 228 // created and their flags. It must be called while still single-threaded. |
225 // | 229 // |
226 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml | 230 // IMPORTANT: Callers must update tools/metrics/histograms/histograms.xml |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 278 |
275 const std::string histogram_name_; | 279 const std::string histogram_name_; |
276 AtomicCount flags_; | 280 AtomicCount flags_; |
277 | 281 |
278 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 282 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
279 }; | 283 }; |
280 | 284 |
281 } // namespace base | 285 } // namespace base |
282 | 286 |
283 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 287 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |