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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // If we observe this flag on a histogram being aggregated into after IPC, | 63 // If we observe this flag on a histogram being aggregated into after IPC, |
64 // then we are running in a single process mode, and the aggregation should | 64 // then we are running in a single process mode, and the aggregation should |
65 // not take place (as we would be aggregating back into the source | 65 // not take place (as we would be aggregating back into the source |
66 // histogram!). | 66 // histogram!). |
67 kIPCSerializationSourceFlag = 0x10, | 67 kIPCSerializationSourceFlag = 0x10, |
68 | 68 |
69 // Only for Histogram and its sub classes: fancy bucket-naming support. | 69 // Only for Histogram and its sub classes: fancy bucket-naming support. |
70 kHexRangePrintingFlag = 0x8000, | 70 kHexRangePrintingFlag = 0x8000, |
71 }; | 71 }; |
72 | 72 |
| 73 // Histogram data inconsistency types. |
| 74 enum Inconsistency { |
| 75 NO_INCONSISTENCIES = 0x0, |
| 76 RANGE_CHECKSUM_ERROR = 0x1, |
| 77 BUCKET_ORDER_ERROR = 0x2, |
| 78 COUNT_HIGH_ERROR = 0x4, |
| 79 COUNT_LOW_ERROR = 0x8, |
| 80 |
| 81 NEVER_EXCEEDED_VALUE = 0x10 |
| 82 }; |
| 83 |
73 explicit HistogramBase(const std::string& name); | 84 explicit HistogramBase(const std::string& name); |
74 virtual ~HistogramBase(); | 85 virtual ~HistogramBase(); |
75 | 86 |
76 std::string histogram_name() const { return histogram_name_; } | 87 std::string histogram_name() const { return histogram_name_; } |
77 | 88 |
78 // Operations with Flags enum. | 89 // Operations with Flags enum. |
79 int32 flags() const { return flags_; } | 90 int32 flags() const { return flags_; } |
80 void SetFlags(int32 flags); | 91 void SetFlags(int32 flags); |
81 void ClearFlags(int32 flags); | 92 void ClearFlags(int32 flags); |
82 | 93 |
(...skipping 13 matching lines...) Expand all Loading... |
96 void AddBoolean(bool value); | 107 void AddBoolean(bool value); |
97 | 108 |
98 virtual void AddSamples(const HistogramSamples& samples) = 0; | 109 virtual void AddSamples(const HistogramSamples& samples) = 0; |
99 virtual bool AddSamplesFromPickle(PickleIterator* iter) = 0; | 110 virtual bool AddSamplesFromPickle(PickleIterator* iter) = 0; |
100 | 111 |
101 // Serialize the histogram info into |pickle|. | 112 // Serialize the histogram info into |pickle|. |
102 // Note: This only serializes the construction arguments of the histogram, but | 113 // Note: This only serializes the construction arguments of the histogram, but |
103 // does not serialize the samples. | 114 // does not serialize the samples. |
104 bool SerializeInfo(Pickle* pickle) const; | 115 bool SerializeInfo(Pickle* pickle) const; |
105 | 116 |
| 117 // Try to find out data corruption from histogram and the samples. |
| 118 // The returned value is a combination of Inconsistency enum. |
| 119 virtual int FindCorruption(const HistogramSamples& samples) const; |
| 120 |
106 // Snapshot the current complete set of sample data. | 121 // Snapshot the current complete set of sample data. |
107 // Override with atomic/locked snapshot if needed. | 122 // Override with atomic/locked snapshot if needed. |
108 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; | 123 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; |
109 | 124 |
110 // The following methods provide graphical histogram displays. | 125 // The following methods provide graphical histogram displays. |
111 virtual void WriteHTMLGraph(std::string* output) const = 0; | 126 virtual void WriteHTMLGraph(std::string* output) const = 0; |
112 virtual void WriteAscii(std::string* output) const = 0; | 127 virtual void WriteAscii(std::string* output) const = 0; |
113 | 128 |
114 // Produce a JSON representation of the histogram. This is implemented with | 129 // Produce a JSON representation of the histogram. This is implemented with |
115 // the help of GetParameters and GetCountAndBucketData; overwrite them to | 130 // the help of GetParameters and GetCountAndBucketData; overwrite them to |
(...skipping 14 matching lines...) Expand all Loading... |
130 private: | 145 private: |
131 const std::string histogram_name_; | 146 const std::string histogram_name_; |
132 int32 flags_; | 147 int32 flags_; |
133 | 148 |
134 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 149 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
135 }; | 150 }; |
136 | 151 |
137 } // namespace base | 152 } // namespace base |
138 | 153 |
139 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 154 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
OLD | NEW |