OLD | NEW |
---|---|
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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1148 if ((*it)->flags() & base::Histogram::kUmaTargetedHistogramFlag) | 1148 if ((*it)->flags() & base::Histogram::kUmaTargetedHistogramFlag) |
1149 histogram_snapshot_manager_.PrepareDelta(*it); | 1149 histogram_snapshot_manager_.PrepareDelta(*it); |
1150 } | 1150 } |
1151 for (MetricsProvider* provider : metrics_providers_) | 1151 for (MetricsProvider* provider : metrics_providers_) |
1152 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); | 1152 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); |
1153 histogram_snapshot_manager_.FinishDeltas(); | 1153 histogram_snapshot_manager_.FinishDeltas(); |
1154 } | 1154 } |
1155 | 1155 |
1156 void MetricsService::RecordCurrentStabilityHistograms() { | 1156 void MetricsService::RecordCurrentStabilityHistograms() { |
1157 DCHECK(log_manager_.current_log()); | 1157 DCHECK(log_manager_.current_log()); |
1158 histogram_snapshot_manager_.StartDeltas(); | |
1158 // "true" indicates that StatisticsRecorder should include histograms in | 1159 // "true" indicates that StatisticsRecorder should include histograms in |
1159 // persistent storage. | 1160 // persistent storage. |
1160 histogram_snapshot_manager_.PrepareDeltas( | 1161 for (auto it = base::StatisticsRecorder::begin(true), |
1161 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1162 end = base::StatisticsRecorder::end(); |
1162 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); | 1163 it != end; ++it) { |
Ilya Sherman
2016/05/05 22:22:52
nit: Why not just write "it != base::StatisticsRec
bcwhite
2016/05/06 16:59:27
Ah. Because end() actually has to create a new it
| |
1164 if (((*it)->flags() & base::Histogram::kUmaStabilityHistogramFlag) == | |
1165 base::Histogram::kUmaStabilityHistogramFlag) { | |
Ilya Sherman
2016/05/05 22:22:52
Optional nit: I personally prefer the style used o
bcwhite
2016/05/06 16:59:27
Me too, but it bites! This particular kUma...Flag
| |
1166 histogram_snapshot_manager_.PrepareDelta(*it); | |
1167 } | |
1168 } | |
1169 for (MetricsProvider* provider : metrics_providers_) | |
1170 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); | |
1171 histogram_snapshot_manager_.FinishDeltas(); | |
1163 } | 1172 } |
1164 | 1173 |
1165 void MetricsService::LogCleanShutdown() { | 1174 void MetricsService::LogCleanShutdown() { |
1166 // Redundant setting to assure that we always reset this value at shutdown | 1175 // Redundant setting to assure that we always reset this value at shutdown |
1167 // (and that we don't use some alternate path, and not call LogCleanShutdown). | 1176 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
1168 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1177 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
1169 | 1178 |
1170 clean_exit_beacon_.WriteBeaconValue(true); | 1179 clean_exit_beacon_.WriteBeaconValue(true); |
1171 RecordCurrentState(local_state_); | 1180 RecordCurrentState(local_state_); |
1172 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1181 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
(...skipping 18 matching lines...) Expand all Loading... | |
1191 base::Time::Now().ToTimeT()); | 1200 base::Time::Now().ToTimeT()); |
1192 } | 1201 } |
1193 | 1202 |
1194 void MetricsService::SkipAndDiscardUpload() { | 1203 void MetricsService::SkipAndDiscardUpload() { |
1195 log_manager_.DiscardStagedLog(); | 1204 log_manager_.DiscardStagedLog(); |
1196 scheduler_->UploadCancelled(); | 1205 scheduler_->UploadCancelled(); |
1197 log_upload_in_progress_ = false; | 1206 log_upload_in_progress_ = false; |
1198 } | 1207 } |
1199 | 1208 |
1200 } // namespace metrics | 1209 } // namespace metrics |
OLD | NEW |