Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: base/metrics/histogram_base.h

Issue 1485763002: Merge multiple histogram snapshots into single one for reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: addressed remaining review comments by Alexei Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // memory segment has been created/attached, used to create a Persistent- 87 // memory segment has been created/attached, used to create a Persistent-
88 // MemoryAllocator, and that loaded into the Histogram module before this 88 // MemoryAllocator, and that loaded into the Histogram module before this
89 // histogram is created. 89 // histogram is created.
90 kIsPersistent = 0x40, 90 kIsPersistent = 0x40,
91 91
92 // Only for Histogram and its sub classes: fancy bucket-naming support. 92 // Only for Histogram and its sub classes: fancy bucket-naming support.
93 kHexRangePrintingFlag = 0x8000, 93 kHexRangePrintingFlag = 0x8000,
94 }; 94 };
95 95
96 // Histogram data inconsistency types. 96 // Histogram data inconsistency types.
97 enum Inconsistency { 97 enum Inconsistency : uint32_t {
98 NO_INCONSISTENCIES = 0x0, 98 NO_INCONSISTENCIES = 0x0,
99 RANGE_CHECKSUM_ERROR = 0x1, 99 RANGE_CHECKSUM_ERROR = 0x1,
100 BUCKET_ORDER_ERROR = 0x2, 100 BUCKET_ORDER_ERROR = 0x2,
101 COUNT_HIGH_ERROR = 0x4, 101 COUNT_HIGH_ERROR = 0x4,
102 COUNT_LOW_ERROR = 0x8, 102 COUNT_LOW_ERROR = 0x8,
103 103
104 NEVER_EXCEEDED_VALUE = 0x10 104 NEVER_EXCEEDED_VALUE = 0x10,
105
106 // This value is used only in HistogramSnapshotManager for marking
107 // internally when new inconsistencies are found.
108 NEW_INCONSISTENCY_FOUND = 0x8000000
105 }; 109 };
106 110
107 explicit HistogramBase(const std::string& name); 111 explicit HistogramBase(const std::string& name);
108 virtual ~HistogramBase(); 112 virtual ~HistogramBase();
109 113
110 const std::string& histogram_name() const { return histogram_name_; } 114 const std::string& histogram_name() const { return histogram_name_; }
111 115
112 // Comapres |name| to the histogram name and triggers a DCHECK if they do not 116 // Comapres |name| to the histogram name and triggers a DCHECK if they do not
113 // match. This is a helper function used by histogram macros, which results in 117 // match. This is a helper function used by histogram macros, which results in
114 // in more compact machine code being generated by the macros. 118 // in more compact machine code being generated by the macros.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void AddSamples(const HistogramSamples& samples) = 0; 151 virtual void AddSamples(const HistogramSamples& samples) = 0;
148 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0; 152 virtual bool AddSamplesFromPickle(base::PickleIterator* iter) = 0;
149 153
150 // Serialize the histogram info into |pickle|. 154 // Serialize the histogram info into |pickle|.
151 // Note: This only serializes the construction arguments of the histogram, but 155 // Note: This only serializes the construction arguments of the histogram, but
152 // does not serialize the samples. 156 // does not serialize the samples.
153 bool SerializeInfo(base::Pickle* pickle) const; 157 bool SerializeInfo(base::Pickle* pickle) const;
154 158
155 // Try to find out data corruption from histogram and the samples. 159 // Try to find out data corruption from histogram and the samples.
156 // The returned value is a combination of Inconsistency enum. 160 // The returned value is a combination of Inconsistency enum.
157 virtual int FindCorruption(const HistogramSamples& samples) const; 161 virtual uint32_t FindCorruption(const HistogramSamples& samples) const;
158 162
159 // Snapshot the current complete set of sample data. 163 // Snapshot the current complete set of sample data.
160 // Override with atomic/locked snapshot if needed. 164 // Override with atomic/locked snapshot if needed.
161 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0; 165 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0;
162 166
167 // Calculate the change (delta) in histogram counts since the previous call
168 // to this method. Each successive call will return only those counts
169 // changed since the last call.
170 virtual scoped_ptr<HistogramSamples> SnapshotDelta() = 0;
171
163 // The following methods provide graphical histogram displays. 172 // The following methods provide graphical histogram displays.
164 virtual void WriteHTMLGraph(std::string* output) const = 0; 173 virtual void WriteHTMLGraph(std::string* output) const = 0;
165 virtual void WriteAscii(std::string* output) const = 0; 174 virtual void WriteAscii(std::string* output) const = 0;
166 175
167 // Produce a JSON representation of the histogram. This is implemented with 176 // Produce a JSON representation of the histogram. This is implemented with
168 // the help of GetParameters and GetCountAndBucketData; overwrite them to 177 // the help of GetParameters and GetCountAndBucketData; overwrite them to
169 // customize the output. 178 // customize the output.
170 void WriteJSON(std::string* output) const; 179 void WriteJSON(std::string* output) const;
171 180
172 protected: 181 protected:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 private: 213 private:
205 const std::string histogram_name_; 214 const std::string histogram_name_;
206 AtomicCount flags_; 215 AtomicCount flags_;
207 216
208 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 217 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
209 }; 218 };
210 219
211 } // namespace base 220 } // namespace base
212 221
213 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 222 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698