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

Unified Diff: components/metrics/metrics_service.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: addressed review comments by Alexei; delete saved metrics file if reporting not enabled 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
Index: components/metrics/metrics_service.cc
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 7e31ddb93156bf301ef333bd5cbe71bb7acc9691..e1ed8d0093cc7588af8632c5ed492b9fc18ab419 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -1155,11 +1155,23 @@ void MetricsService::RecordCurrentHistograms() {
void MetricsService::RecordCurrentStabilityHistograms() {
DCHECK(log_manager_.current_log());
+ histogram_snapshot_manager_.StartDeltas();
// "true" indicates that StatisticsRecorder should include histograms in
// persistent storage.
- histogram_snapshot_manager_.PrepareDeltas(
- base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(),
- base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag);
+ for (auto it = base::StatisticsRecorder::begin(true),
+ end = base::StatisticsRecorder::end();
+ it != end; ++it) {
+ // kUmaStabilityHistogramFlag is actually a combination of two flags and
+ // so the result of the bitwise-and must be checked against the "flag"
+ // value or incorrect matches will occur.
+ if (((*it)->flags() & base::Histogram::kUmaStabilityHistogramFlag) ==
+ base::Histogram::kUmaStabilityHistogramFlag) {
Alexei Svitkine (slow) 2016/05/10 19:55:42 I would actually prefer we don't duplicate this lo
bcwhite 2016/05/11 15:47:12 Done.
+ histogram_snapshot_manager_.PrepareDelta(*it);
+ }
+ }
+ for (MetricsProvider* provider : metrics_providers_)
+ provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_);
+ histogram_snapshot_manager_.FinishDeltas();
}
void MetricsService::LogCleanShutdown() {

Powered by Google App Engine
This is Rietveld 408576698