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

Unified Diff: base/metrics/histogram.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.h
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 503d246379c01099fe91b1447587c56ccfb0b5bf..78ab116ae20aede99f5135685f8cb977e89832ec 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -264,8 +264,13 @@ class BASE_EXPORT Histogram : public HistogramBase {
base::PickleIterator* iter);
static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
- // Implementation of SnapshotSamples function.
- std::unique_ptr<SampleVector> SnapshotSampleVector() const;
+ // Create a snapshot containing all samples (both logged and unlogged).
+ // Implementation of SnapshotSamples method with a more specific type for
+ // internal use.
+ std::unique_ptr<SampleVector> SnapshotAllSamples() const;
+
+ // Create a copy of unlogged samples.
+ std::unique_ptr<SampleVector> SnapshotUnloggedSamples() const;
//----------------------------------------------------------------------------
// Helpers for emitting Ascii graphic. Each method appends data to output.
@@ -303,11 +308,10 @@ class BASE_EXPORT Histogram : public HistogramBase {
Sample declared_min_; // Less than this goes into the first bucket.
Sample declared_max_; // Over this goes into the last bucket.
- // Finally, provide the state that changes with the addition of each new
- // sample.
- std::unique_ptr<SampleVectorBase> samples_;
+ // Samples that have not yet been logged with SnapshotDelta().
+ std::unique_ptr<HistogramSamples> unlogged_samples_;
- // Also keep a previous uploaded state for calculating deltas.
+ // Accumulation of all samples that have been logged with SnapshotDelta().
std::unique_ptr<HistogramSamples> logged_samples_;
// Flag to indicate if PrepareFinalDelta has been previously called. It is
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698