Chromium Code Reviews| 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 auto end = base::StatisticsRecorder::end(); |
|
Ilya Sherman
2016/05/05 07:22:37
nit: Please move this so that it's scoped to withi
bcwhite
2016/05/05 16:01:17
Done.
| |
| 1161 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1162 for (auto it = base::StatisticsRecorder::begin(true); it != end; ++it) { |
| 1162 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); | 1163 if (((*it)->flags() & base::Histogram::kUmaStabilityHistogramFlag) == |
| 1164 base::Histogram::kUmaStabilityHistogramFlag) { | |
| 1165 histogram_snapshot_manager_.PrepareDelta(*it); | |
| 1166 } | |
| 1167 } | |
| 1168 for (MetricsProvider* provider : metrics_providers_) | |
| 1169 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); | |
|
Ilya Sherman
2016/05/05 07:22:37
Providers might choose to include metrics that are
bcwhite
2016/05/05 16:01:17
You mean on line 1163? That's always been there a
Ilya Sherman
2016/05/05 22:22:52
Ah, I was misreading the code. Thanks for explain
| |
| 1170 histogram_snapshot_manager_.FinishDeltas(); | |
| 1163 } | 1171 } |
| 1164 | 1172 |
| 1165 void MetricsService::LogCleanShutdown() { | 1173 void MetricsService::LogCleanShutdown() { |
| 1166 // Redundant setting to assure that we always reset this value at shutdown | 1174 // 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). | 1175 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
| 1168 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1176 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
| 1169 | 1177 |
| 1170 clean_exit_beacon_.WriteBeaconValue(true); | 1178 clean_exit_beacon_.WriteBeaconValue(true); |
| 1171 RecordCurrentState(local_state_); | 1179 RecordCurrentState(local_state_); |
| 1172 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1180 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1191 base::Time::Now().ToTimeT()); | 1199 base::Time::Now().ToTimeT()); |
| 1192 } | 1200 } |
| 1193 | 1201 |
| 1194 void MetricsService::SkipAndDiscardUpload() { | 1202 void MetricsService::SkipAndDiscardUpload() { |
| 1195 log_manager_.DiscardStagedLog(); | 1203 log_manager_.DiscardStagedLog(); |
| 1196 scheduler_->UploadCancelled(); | 1204 scheduler_->UploadCancelled(); |
| 1197 log_upload_in_progress_ = false; | 1205 log_upload_in_progress_ = false; |
| 1198 } | 1206 } |
| 1199 | 1207 |
| 1200 } // namespace metrics | 1208 } // namespace metrics |
| OLD | NEW |