| 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 // Calculate the change (delta) in histogram counts since the previous call |
| 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 |
| 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 |
| 210 // can be made on "const" histograms such as those with data held in |
| 211 // read-only memory. |
| 212 virtual std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const = 0; |
| 213 |
| 205 // The following methods provide graphical histogram displays. | 214 // The following methods provide graphical histogram displays. |
| 206 virtual void WriteHTMLGraph(std::string* output) const = 0; | 215 virtual void WriteHTMLGraph(std::string* output) const = 0; |
| 207 virtual void WriteAscii(std::string* output) const = 0; | 216 virtual void WriteAscii(std::string* output) const = 0; |
| 208 | 217 |
| 209 // Produce a JSON representation of the histogram. This is implemented with | 218 // Produce a JSON representation of the histogram. This is implemented with |
| 210 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 219 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
| 211 // customize the output. | 220 // customize the output. |
| 212 void WriteJSON(std::string* output) const; | 221 void WriteJSON(std::string* output) const; |
| 213 | 222 |
| 214 // This enables a histogram that reports the what types of histograms are | 223 // This enables a histogram that reports the what types of histograms are |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 274 |
| 266 const std::string histogram_name_; | 275 const std::string histogram_name_; |
| 267 AtomicCount flags_; | 276 AtomicCount flags_; |
| 268 | 277 |
| 269 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 278 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
| 270 }; | 279 }; |
| 271 | 280 |
| 272 } // namespace base | 281 } // namespace base |
| 273 | 282 |
| 274 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 283 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
| OLD | NEW |