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

Unified Diff: base/metrics/histogram.cc

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed some build problems Created 4 years, 8 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
Index: base/metrics/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 86c6746c0f590199cefe57c21d35ed4fcb7bd3a2..bf3c3ab6cfd317d9c366e25504b4e746c6382597 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -453,6 +453,15 @@ std::unique_ptr<HistogramSamples> Histogram::SnapshotDelta() {
return snapshot;
}
+std::unique_ptr<HistogramSamples> Histogram::SnapshotDifference() const {
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698