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

Side by Side Diff: components/metrics/metrics_service.cc

Issue 1537743006: Persist setup metrics and have Chrome report them during UMA upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: address (many) comments by Greg Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 1100
1101 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { 1101 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) {
1102 std::vector<variations::ActiveGroupId> synthetic_trials; 1102 std::vector<variations::ActiveGroupId> synthetic_trials;
1103 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials); 1103 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials);
1104 log->RecordEnvironment(metrics_providers_.get(), synthetic_trials, 1104 log->RecordEnvironment(metrics_providers_.get(), synthetic_trials,
1105 GetInstallDate(), GetMetricsReportingEnabledDate()); 1105 GetInstallDate(), GetMetricsReportingEnabledDate());
1106 } 1106 }
1107 1107
1108 void MetricsService::RecordCurrentHistograms() { 1108 void MetricsService::RecordCurrentHistograms() {
1109 DCHECK(log_manager_.current_log()); 1109 DCHECK(log_manager_.current_log());
1110 histogram_snapshot_manager_.StartDeltas();
1111 for (size_t i = 0; i < metrics_providers_.size(); ++i) {
grt (UTC plus 2) 2016/02/08 18:09:19 will this work: for (auto& provider : metrics_pr
bcwhite 2016/02/09 21:08:46 Seems to work. I'll updated it elsewhere in the f
1112 metrics_providers_[i]->RecordHistogramSnapshots(
1113 &histogram_snapshot_manager_);
1114 }
1115 histogram_snapshot_manager_.FinishDeltas();
1110 } 1116 }
1111 1117
1112 void MetricsService::RecordCurrentStabilityHistograms() { 1118 void MetricsService::RecordCurrentStabilityHistograms() {
1113 DCHECK(log_manager_.current_log()); 1119 DCHECK(log_manager_.current_log());
1114 // "true" indicates that StatisticsRecorder should include histograms in 1120 // "true" indicates that StatisticsRecorder should include histograms in
1115 // persistent storage. 1121 // persistent storage.
1116 histogram_snapshot_manager_.PrepareDeltas( 1122 histogram_snapshot_manager_.PrepareDeltas(
1117 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), 1123 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(),
1118 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); 1124 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag);
1119 } 1125 }
(...skipping 27 matching lines...) Expand all
1147 base::Time::Now().ToTimeT()); 1153 base::Time::Now().ToTimeT());
1148 } 1154 }
1149 1155
1150 void MetricsService::SkipAndDiscardUpload() { 1156 void MetricsService::SkipAndDiscardUpload() {
1151 log_manager_.DiscardStagedLog(); 1157 log_manager_.DiscardStagedLog();
1152 scheduler_->UploadCancelled(); 1158 scheduler_->UploadCancelled();
1153 log_upload_in_progress_ = false; 1159 log_upload_in_progress_ = false;
1154 } 1160 }
1155 1161
1156 } // namespace metrics 1162 } // namespace metrics
OLDNEW
« components/metrics/metrics_provider.h ('K') | « components/metrics/metrics_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698