Index: base/metrics/histogram.cc |
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc |
index 86c6746c0f590199cefe57c21d35ed4fcb7bd3a2..3571657513f6482c5724f721c17e8a2c354ab79a 100644 |
--- a/base/metrics/histogram.cc |
+++ b/base/metrics/histogram.cc |
@@ -439,6 +439,8 @@ std::unique_ptr<HistogramSamples> Histogram::SnapshotSamples() const { |
} |
std::unique_ptr<HistogramSamples> Histogram::SnapshotDelta() { |
+ DCHECK(!final_delta_created_); |
+ |
std::unique_ptr<HistogramSamples> snapshot = SnapshotSampleVector(); |
if (!logged_samples_) { |
// If nothing has been previously logged, save this one as |
@@ -453,6 +455,18 @@ std::unique_ptr<HistogramSamples> Histogram::SnapshotDelta() { |
return snapshot; |
} |
+std::unique_ptr<HistogramSamples> Histogram::SnapshotFinalDelta() const { |
+ DCHECK(!final_delta_created_); |
+ final_delta_created_ = true; |
+ |
+ std::unique_ptr<HistogramSamples> snapshot = SnapshotSampleVector(); |
+ |
+ // Subtract what was previously logged and then return. |
+ if (logged_samples_) |
+ snapshot->Subtract(*logged_samples_); |
+ return snapshot; |
+} |
+ |
void Histogram::AddSamples(const HistogramSamples& samples) { |
samples_->Add(samples); |
} |