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> |
11 | 11 |
| 12 #include <memory> |
12 #include <string> | 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
16 #include "base/base_export.h" | 17 #include "base/base_export.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/scoped_ptr.h" | |
19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 | 23 |
24 class BucketRanges; | 24 class BucketRanges; |
25 class DictionaryValue; | 25 class DictionaryValue; |
26 class HistogramBase; | 26 class HistogramBase; |
27 class HistogramSamples; | 27 class HistogramSamples; |
28 class ListValue; | 28 class ListValue; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Note: This only serializes the construction arguments of the histogram, but | 188 // Note: This only serializes the construction arguments of the histogram, but |
189 // does not serialize the samples. | 189 // does not serialize the samples. |
190 bool SerializeInfo(base::Pickle* pickle) const; | 190 bool SerializeInfo(base::Pickle* pickle) const; |
191 | 191 |
192 // Try to find out data corruption from histogram and the samples. | 192 // Try to find out data corruption from histogram and the samples. |
193 // The returned value is a combination of Inconsistency enum. | 193 // The returned value is a combination of Inconsistency enum. |
194 virtual uint32_t FindCorruption(const HistogramSamples& samples) const; | 194 virtual uint32_t FindCorruption(const HistogramSamples& samples) const; |
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 scoped_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 scoped_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. |
206 virtual void WriteHTMLGraph(std::string* output) const = 0; | 206 virtual void WriteHTMLGraph(std::string* output) const = 0; |
207 virtual void WriteAscii(std::string* output) const = 0; | 207 virtual void WriteAscii(std::string* output) const = 0; |
208 | 208 |
209 // Produce a JSON representation of the histogram. This is implemented with | 209 // Produce a JSON representation of the histogram. This is implemented with |
210 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 210 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
211 // customize the output. | 211 // customize the output. |
212 void WriteJSON(std::string* output) const; | 212 void WriteJSON(std::string* output) const; |
213 | 213 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 const std::string histogram_name_; | 266 const std::string histogram_name_; |
267 AtomicCount flags_; | 267 AtomicCount flags_; |
268 | 268 |
269 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 269 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
270 }; | 270 }; |
271 | 271 |
272 } // namespace base | 272 } // namespace base |
273 | 273 |
274 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 274 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |