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

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: removed some unnecessary includes Created 4 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 | « base/metrics/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « base/metrics/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698