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

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

Issue 2867303004: [histogram] Make histograms more resistant to overflows. (Closed)
Patch Set: final final fix Created 3 years, 7 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_unittest.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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Note: This only serializes the construction arguments of the histogram, but 180 // Note: This only serializes the construction arguments of the histogram, but
181 // does not serialize the samples. 181 // does not serialize the samples.
182 bool SerializeInfo(base::Pickle* pickle) const; 182 bool SerializeInfo(base::Pickle* pickle) const;
183 183
184 // Try to find out data corruption from histogram and the samples. 184 // Try to find out data corruption from histogram and the samples.
185 // The returned value is a combination of Inconsistency enum. 185 // The returned value is a combination of Inconsistency enum.
186 virtual uint32_t FindCorruption(const HistogramSamples& samples) const; 186 virtual uint32_t FindCorruption(const HistogramSamples& samples) const;
187 187
188 // Snapshot the current complete set of sample data. 188 // Snapshot the current complete set of sample data.
189 // Override with atomic/locked snapshot if needed. 189 // Override with atomic/locked snapshot if needed.
190 // NOTE: this data can overflow for long-running sessions. It should be
191 // handled with care and this method is recommended to be used only
192 // in about:histograms and test code.
190 virtual std::unique_ptr<HistogramSamples> SnapshotSamples() const = 0; 193 virtual std::unique_ptr<HistogramSamples> SnapshotSamples() const = 0;
191 194
192 // Calculate the change (delta) in histogram counts since the previous call 195 // Calculate the change (delta) in histogram counts since the previous call
193 // to this method. Each successive call will return only those counts 196 // to this method. Each successive call will return only those counts
194 // changed since the last call. 197 // changed since the last call.
195 virtual std::unique_ptr<HistogramSamples> SnapshotDelta() = 0; 198 virtual std::unique_ptr<HistogramSamples> SnapshotDelta() = 0;
196 199
197 // Calculate the change (delta) in histogram counts since the previous call 200 // Calculate the change (delta) in histogram counts since the previous call
198 // to SnapshotDelta() but do so without modifying any internal data as to 201 // to SnapshotDelta() but do so without modifying any internal data as to
199 // what was previous logged. After such a call, no further calls to this 202 // what was previous logged. After such a call, no further calls to this
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 269
267 const std::string histogram_name_; 270 const std::string histogram_name_;
268 AtomicCount flags_; 271 AtomicCount flags_;
269 272
270 DISALLOW_COPY_AND_ASSIGN(HistogramBase); 273 DISALLOW_COPY_AND_ASSIGN(HistogramBase);
271 }; 274 };
272 275
273 } // namespace base 276 } // namespace base
274 277
275 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ 278 #endif // BASE_METRICS_HISTOGRAM_BASE_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698