| 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) { |
| 1164 // kUmaStabilityHistogramFlag is actually a combination of two flags and |
| 1165 // so the result of the bitwise-and must be checked against the "flag" |
| 1166 // value or incorrect matches will occur. |
| 1167 if (((*it)->flags() & base::Histogram::kUmaStabilityHistogramFlag) == |
| 1168 base::Histogram::kUmaStabilityHistogramFlag) { |
| 1169 histogram_snapshot_manager_.PrepareDelta(*it); |
| 1170 } |
| 1171 } |
| 1172 for (MetricsProvider* provider : metrics_providers_) |
| 1173 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); |
| 1174 histogram_snapshot_manager_.FinishDeltas(); |
| 1163 } | 1175 } |
| 1164 | 1176 |
| 1165 void MetricsService::LogCleanShutdown() { | 1177 void MetricsService::LogCleanShutdown() { |
| 1166 // Redundant setting to assure that we always reset this value at shutdown | 1178 // 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). | 1179 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
| 1168 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1180 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
| 1169 | 1181 |
| 1170 clean_exit_beacon_.WriteBeaconValue(true); | 1182 clean_exit_beacon_.WriteBeaconValue(true); |
| 1171 RecordCurrentState(local_state_); | 1183 RecordCurrentState(local_state_); |
| 1172 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1184 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1191 base::Time::Now().ToTimeT()); | 1203 base::Time::Now().ToTimeT()); |
| 1192 } | 1204 } |
| 1193 | 1205 |
| 1194 void MetricsService::SkipAndDiscardUpload() { | 1206 void MetricsService::SkipAndDiscardUpload() { |
| 1195 log_manager_.DiscardStagedLog(); | 1207 log_manager_.DiscardStagedLog(); |
| 1196 scheduler_->UploadCancelled(); | 1208 scheduler_->UploadCancelled(); |
| 1197 log_upload_in_progress_ = false; | 1209 log_upload_in_progress_ = false; |
| 1198 } | 1210 } |
| 1199 | 1211 |
| 1200 } // namespace metrics | 1212 } // namespace metrics |
| OLD | NEW |