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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 upload_scheduler_.reset(new MetricsUploadScheduler(send_next_log_callback)); | 309 upload_scheduler_.reset(new MetricsUploadScheduler(send_next_log_callback)); |
310 } else { | 310 } else { |
311 scheduler_.reset(new MetricsReportingScheduler( | 311 scheduler_.reset(new MetricsReportingScheduler( |
312 upload_callback, | 312 upload_callback, |
313 // MetricsServiceClient outlives MetricsService, and | 313 // MetricsServiceClient outlives MetricsService, and |
314 // MetricsReportingScheduler is tied to the lifetime of |this|. | 314 // MetricsReportingScheduler is tied to the lifetime of |this|. |
315 base::Bind(&MetricsServiceClient::GetStandardUploadInterval, | 315 base::Bind(&MetricsServiceClient::GetStandardUploadInterval, |
316 base::Unretained(client_)))); | 316 base::Unretained(client_)))); |
317 } | 317 } |
318 | 318 |
319 for (MetricsProvider* provider : metrics_providers_) | 319 for (auto& provider : metrics_providers_) |
320 provider->Init(); | 320 provider->Init(); |
321 } | 321 } |
322 | 322 |
323 void MetricsService::Start() { | 323 void MetricsService::Start() { |
324 HandleIdleSinceLastTransmission(false); | 324 HandleIdleSinceLastTransmission(false); |
325 EnableRecording(); | 325 EnableRecording(); |
326 EnableReporting(); | 326 EnableReporting(); |
327 } | 327 } |
328 | 328 |
329 void MetricsService::StartRecordingForTests() { | 329 void MetricsService::StartRecordingForTests() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 if (recording_state_ == ACTIVE) | 371 if (recording_state_ == ACTIVE) |
372 return; | 372 return; |
373 recording_state_ = ACTIVE; | 373 recording_state_ = ACTIVE; |
374 | 374 |
375 state_manager_->ForceClientIdCreation(); | 375 state_manager_->ForceClientIdCreation(); |
376 client_->SetMetricsClientId(state_manager_->client_id()); | 376 client_->SetMetricsClientId(state_manager_->client_id()); |
377 if (!log_manager_.current_log()) | 377 if (!log_manager_.current_log()) |
378 OpenNewLog(); | 378 OpenNewLog(); |
379 | 379 |
380 for (MetricsProvider* provider : metrics_providers_) | 380 for (auto& provider : metrics_providers_) |
381 provider->OnRecordingEnabled(); | 381 provider->OnRecordingEnabled(); |
382 | 382 |
383 base::RemoveActionCallback(action_callback_); | 383 base::RemoveActionCallback(action_callback_); |
384 action_callback_ = base::Bind(&MetricsService::OnUserAction, | 384 action_callback_ = base::Bind(&MetricsService::OnUserAction, |
385 base::Unretained(this)); | 385 base::Unretained(this)); |
386 base::AddActionCallback(action_callback_); | 386 base::AddActionCallback(action_callback_); |
387 } | 387 } |
388 | 388 |
389 void MetricsService::DisableRecording() { | 389 void MetricsService::DisableRecording() { |
390 DCHECK(thread_checker_.CalledOnValidThread()); | 390 DCHECK(thread_checker_.CalledOnValidThread()); |
391 | 391 |
392 if (recording_state_ == INACTIVE) | 392 if (recording_state_ == INACTIVE) |
393 return; | 393 return; |
394 recording_state_ = INACTIVE; | 394 recording_state_ = INACTIVE; |
395 | 395 |
396 base::RemoveActionCallback(action_callback_); | 396 base::RemoveActionCallback(action_callback_); |
397 | 397 |
398 for (MetricsProvider* provider : metrics_providers_) | 398 for (auto& provider : metrics_providers_) |
399 provider->OnRecordingDisabled(); | 399 provider->OnRecordingDisabled(); |
400 | 400 |
401 PushPendingLogsToPersistentStorage(); | 401 PushPendingLogsToPersistentStorage(); |
402 } | 402 } |
403 | 403 |
404 bool MetricsService::recording_active() const { | 404 bool MetricsService::recording_active() const { |
405 DCHECK(thread_checker_.CalledOnValidThread()); | 405 DCHECK(thread_checker_.CalledOnValidThread()); |
406 return recording_state_ == ACTIVE; | 406 return recording_state_ == ACTIVE; |
407 } | 407 } |
408 | 408 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 rotation_scheduler_->Stop(); | 462 rotation_scheduler_->Stop(); |
463 upload_scheduler_->Stop(); | 463 upload_scheduler_->Stop(); |
464 } else { | 464 } else { |
465 scheduler_->Stop(); | 465 scheduler_->Stop(); |
466 } | 466 } |
467 | 467 |
468 MarkAppCleanShutdownAndCommit(&clean_exit_beacon_, local_state_); | 468 MarkAppCleanShutdownAndCommit(&clean_exit_beacon_, local_state_); |
469 | 469 |
470 // Give providers a chance to persist histograms as part of being | 470 // Give providers a chance to persist histograms as part of being |
471 // backgrounded. | 471 // backgrounded. |
472 for (MetricsProvider* provider : metrics_providers_) | 472 for (auto& provider : metrics_providers_) |
473 provider->OnAppEnterBackground(); | 473 provider->OnAppEnterBackground(); |
474 | 474 |
475 // At this point, there's no way of knowing when the process will be | 475 // At this point, there's no way of knowing when the process will be |
476 // killed, so this has to be treated similar to a shutdown, closing and | 476 // killed, so this has to be treated similar to a shutdown, closing and |
477 // persisting all logs. Unlinke a shutdown, the state is primed to be ready | 477 // persisting all logs. Unlinke a shutdown, the state is primed to be ready |
478 // to continue logging and uploading if the process does return. | 478 // to continue logging and uploading if the process does return. |
479 if (recording_active() && state_ >= SENDING_LOGS) { | 479 if (recording_active() && state_ >= SENDING_LOGS) { |
480 PushPendingLogsToPersistentStorage(); | 480 PushPendingLogsToPersistentStorage(); |
481 // Persisting logs closes the current log, so start recording a new log | 481 // Persisting logs closes the current log, so start recording a new log |
482 // immediately to capture any background work that might be done before the | 482 // immediately to capture any background work that might be done before the |
(...skipping 29 matching lines...) Expand all Loading... |
512 } | 512 } |
513 | 513 |
514 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { | 514 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { |
515 if (!has_debugger) | 515 if (!has_debugger) |
516 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent); | 516 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent); |
517 else | 517 else |
518 IncrementPrefValue(prefs::kStabilityDebuggerPresent); | 518 IncrementPrefValue(prefs::kStabilityDebuggerPresent); |
519 } | 519 } |
520 | 520 |
521 void MetricsService::ClearSavedStabilityMetrics() { | 521 void MetricsService::ClearSavedStabilityMetrics() { |
522 for (MetricsProvider* provider : metrics_providers_) | 522 for (auto& provider : metrics_providers_) |
523 provider->ClearSavedStabilityMetrics(); | 523 provider->ClearSavedStabilityMetrics(); |
524 | 524 |
525 // Reset the prefs that are managed by MetricsService/MetricsLog directly. | 525 // Reset the prefs that are managed by MetricsService/MetricsLog directly. |
526 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationSuccess, 0); | 526 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationSuccess, 0); |
527 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0); | 527 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0); |
528 local_state_->SetInteger(prefs::kStabilityCrashCount, 0); | 528 local_state_->SetInteger(prefs::kStabilityCrashCount, 0); |
529 local_state_->SetInteger(prefs::kStabilityDebuggerPresent, 0); | 529 local_state_->SetInteger(prefs::kStabilityDebuggerPresent, 0); |
530 local_state_->SetInteger(prefs::kStabilityDebuggerNotPresent, 0); | 530 local_state_->SetInteger(prefs::kStabilityDebuggerNotPresent, 0); |
531 local_state_->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0); | 531 local_state_->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0); |
532 local_state_->SetInteger(prefs::kStabilityLaunchCount, 0); | 532 local_state_->SetInteger(prefs::kStabilityLaunchCount, 0); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 const int64_t incremental_time_secs = incremental_uptime->InSeconds(); | 700 const int64_t incremental_time_secs = incremental_uptime->InSeconds(); |
701 if (incremental_time_secs > 0) { | 701 if (incremental_time_secs > 0) { |
702 int64_t metrics_uptime = pref->GetInt64(prefs::kUninstallMetricsUptimeSec); | 702 int64_t metrics_uptime = pref->GetInt64(prefs::kUninstallMetricsUptimeSec); |
703 metrics_uptime += incremental_time_secs; | 703 metrics_uptime += incremental_time_secs; |
704 pref->SetInt64(prefs::kUninstallMetricsUptimeSec, metrics_uptime); | 704 pref->SetInt64(prefs::kUninstallMetricsUptimeSec, metrics_uptime); |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 void MetricsService::NotifyOnDidCreateMetricsLog() { | 708 void MetricsService::NotifyOnDidCreateMetricsLog() { |
709 DCHECK(thread_checker_.CalledOnValidThread()); | 709 DCHECK(thread_checker_.CalledOnValidThread()); |
710 for (MetricsProvider* provider : metrics_providers_) | 710 for (auto& provider : metrics_providers_) |
711 provider->OnDidCreateMetricsLog(); | 711 provider->OnDidCreateMetricsLog(); |
712 } | 712 } |
713 | 713 |
714 | 714 |
715 //------------------------------------------------------------------------------ | 715 //------------------------------------------------------------------------------ |
716 // Recording control methods | 716 // Recording control methods |
717 | 717 |
718 void MetricsService::OpenNewLog() { | 718 void MetricsService::OpenNewLog() { |
719 DCHECK(!log_manager_.current_log()); | 719 DCHECK(!log_manager_.current_log()); |
720 | 720 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // Put incremental data (histogram deltas, and realtime stats deltas) at the | 761 // Put incremental data (histogram deltas, and realtime stats deltas) at the |
762 // end of all log transmissions (initial log handles this separately). | 762 // end of all log transmissions (initial log handles this separately). |
763 // RecordIncrementalStabilityElements only exists on the derived | 763 // RecordIncrementalStabilityElements only exists on the derived |
764 // MetricsLog class. | 764 // MetricsLog class. |
765 MetricsLog* current_log = log_manager_.current_log(); | 765 MetricsLog* current_log = log_manager_.current_log(); |
766 DCHECK(current_log); | 766 DCHECK(current_log); |
767 RecordCurrentEnvironment(current_log); | 767 RecordCurrentEnvironment(current_log); |
768 base::TimeDelta incremental_uptime; | 768 base::TimeDelta incremental_uptime; |
769 base::TimeDelta uptime; | 769 base::TimeDelta uptime; |
770 GetUptimes(local_state_, &incremental_uptime, &uptime); | 770 GetUptimes(local_state_, &incremental_uptime, &uptime); |
771 current_log->RecordStabilityMetrics(metrics_providers_.get(), | 771 current_log->RecordStabilityMetrics(metrics_providers_, incremental_uptime, |
772 incremental_uptime, uptime); | 772 uptime); |
773 | 773 |
774 current_log->RecordGeneralMetrics(metrics_providers_.get()); | 774 current_log->RecordGeneralMetrics(metrics_providers_); |
775 RecordCurrentHistograms(); | 775 RecordCurrentHistograms(); |
776 DVLOG(1) << "Generated an ongoing log."; | 776 DVLOG(1) << "Generated an ongoing log."; |
777 log_manager_.FinishCurrentLog(); | 777 log_manager_.FinishCurrentLog(); |
778 } | 778 } |
779 | 779 |
780 void MetricsService::PushPendingLogsToPersistentStorage() { | 780 void MetricsService::PushPendingLogsToPersistentStorage() { |
781 if (state_ < SENDING_LOGS) | 781 if (state_ < SENDING_LOGS) |
782 return; // We didn't and still don't have time to get plugin list etc. | 782 return; // We didn't and still don't have time to get plugin list etc. |
783 | 783 |
784 CloseCurrentLog(); | 784 CloseCurrentLog(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 upload_canceled); | 937 upload_canceled); |
938 } | 938 } |
939 } | 939 } |
940 | 940 |
941 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { | 941 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { |
942 // Check whether any metrics provider has initial stability metrics. | 942 // Check whether any metrics provider has initial stability metrics. |
943 // All providers are queried (rather than stopping after the first "true" | 943 // All providers are queried (rather than stopping after the first "true" |
944 // response) in case they do any kind of setup work in preparation for | 944 // response) in case they do any kind of setup work in preparation for |
945 // the later call to RecordInitialHistogramSnapshots(). | 945 // the later call to RecordInitialHistogramSnapshots(). |
946 bool has_stability_metrics = false; | 946 bool has_stability_metrics = false; |
947 for (MetricsProvider* provider : metrics_providers_) | 947 for (auto& provider : metrics_providers_) |
948 has_stability_metrics |= provider->HasInitialStabilityMetrics(); | 948 has_stability_metrics |= provider->HasInitialStabilityMetrics(); |
949 | 949 |
950 return has_stability_metrics; | 950 return has_stability_metrics; |
951 } | 951 } |
952 | 952 |
953 bool MetricsService::PrepareInitialStabilityLog( | 953 bool MetricsService::PrepareInitialStabilityLog( |
954 const std::string& prefs_previous_version) { | 954 const std::string& prefs_previous_version) { |
955 DCHECK_EQ(INITIALIZED, state_); | 955 DCHECK_EQ(INITIALIZED, state_); |
956 | 956 |
957 std::unique_ptr<MetricsLog> initial_stability_log( | 957 std::unique_ptr<MetricsLog> initial_stability_log( |
958 CreateLog(MetricsLog::INITIAL_STABILITY_LOG)); | 958 CreateLog(MetricsLog::INITIAL_STABILITY_LOG)); |
959 | 959 |
960 // Do not call NotifyOnDidCreateMetricsLog here because the stability | 960 // Do not call NotifyOnDidCreateMetricsLog here because the stability |
961 // log describes stats from the _previous_ session. | 961 // log describes stats from the _previous_ session. |
962 std::string system_profile_app_version; | 962 std::string system_profile_app_version; |
963 if (!initial_stability_log->LoadSavedEnvironmentFromPrefs( | 963 if (!initial_stability_log->LoadSavedEnvironmentFromPrefs( |
964 &system_profile_app_version)) { | 964 &system_profile_app_version)) { |
965 return false; | 965 return false; |
966 } | 966 } |
967 if (system_profile_app_version != prefs_previous_version) | 967 if (system_profile_app_version != prefs_previous_version) |
968 IncrementPrefValue(prefs::kStabilityVersionMismatchCount); | 968 IncrementPrefValue(prefs::kStabilityVersionMismatchCount); |
969 | 969 |
970 log_manager_.PauseCurrentLog(); | 970 log_manager_.PauseCurrentLog(); |
971 log_manager_.BeginLoggingWithLog(std::move(initial_stability_log)); | 971 log_manager_.BeginLoggingWithLog(std::move(initial_stability_log)); |
972 | 972 |
973 // Note: Some stability providers may record stability stats via histograms, | 973 // Note: Some stability providers may record stability stats via histograms, |
974 // so this call has to be after BeginLoggingWithLog(). | 974 // so this call has to be after BeginLoggingWithLog(). |
975 log_manager_.current_log()->RecordStabilityMetrics( | 975 log_manager_.current_log()->RecordStabilityMetrics( |
976 metrics_providers_.get(), base::TimeDelta(), base::TimeDelta()); | 976 metrics_providers_, base::TimeDelta(), base::TimeDelta()); |
977 RecordCurrentStabilityHistograms(); | 977 RecordCurrentStabilityHistograms(); |
978 | 978 |
979 // Note: RecordGeneralMetrics() intentionally not called since this log is for | 979 // Note: RecordGeneralMetrics() intentionally not called since this log is for |
980 // stability stats from a previous session only. | 980 // stability stats from a previous session only. |
981 | 981 |
982 DVLOG(1) << "Generated an stability log."; | 982 DVLOG(1) << "Generated an stability log."; |
983 log_manager_.FinishCurrentLog(); | 983 log_manager_.FinishCurrentLog(); |
984 log_manager_.ResumePausedLog(); | 984 log_manager_.ResumePausedLog(); |
985 | 985 |
986 // Store unsent logs, including the stability log that was just saved, so | 986 // Store unsent logs, including the stability log that was just saved, so |
(...skipping 12 matching lines...) Expand all Loading... |
999 GetUptimes(local_state_, &incremental_uptime, &uptime); | 999 GetUptimes(local_state_, &incremental_uptime, &uptime); |
1000 | 1000 |
1001 // Histograms only get written to the current log, so make the new log current | 1001 // Histograms only get written to the current log, so make the new log current |
1002 // before writing them. | 1002 // before writing them. |
1003 log_manager_.PauseCurrentLog(); | 1003 log_manager_.PauseCurrentLog(); |
1004 log_manager_.BeginLoggingWithLog(std::move(initial_metrics_log_)); | 1004 log_manager_.BeginLoggingWithLog(std::move(initial_metrics_log_)); |
1005 | 1005 |
1006 // Note: Some stability providers may record stability stats via histograms, | 1006 // Note: Some stability providers may record stability stats via histograms, |
1007 // so this call has to be after BeginLoggingWithLog(). | 1007 // so this call has to be after BeginLoggingWithLog(). |
1008 MetricsLog* current_log = log_manager_.current_log(); | 1008 MetricsLog* current_log = log_manager_.current_log(); |
1009 current_log->RecordStabilityMetrics(metrics_providers_.get(), | 1009 current_log->RecordStabilityMetrics(metrics_providers_, base::TimeDelta(), |
1010 base::TimeDelta(), base::TimeDelta()); | 1010 base::TimeDelta()); |
1011 current_log->RecordGeneralMetrics(metrics_providers_.get()); | 1011 current_log->RecordGeneralMetrics(metrics_providers_); |
1012 RecordCurrentHistograms(); | 1012 RecordCurrentHistograms(); |
1013 | 1013 |
1014 DVLOG(1) << "Generated an initial log."; | 1014 DVLOG(1) << "Generated an initial log."; |
1015 log_manager_.FinishCurrentLog(); | 1015 log_manager_.FinishCurrentLog(); |
1016 log_manager_.ResumePausedLog(); | 1016 log_manager_.ResumePausedLog(); |
1017 | 1017 |
1018 // Store unsent logs, including the initial log that was just saved, so | 1018 // Store unsent logs, including the initial log that was just saved, so |
1019 // that they're not lost in case of a crash before upload time. | 1019 // that they're not lost in case of a crash before upload time. |
1020 log_manager_.PersistUnsentLogs(); | 1020 log_manager_.PersistUnsentLogs(); |
1021 | 1021 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 MetricsLog::LogType log_type) { | 1208 MetricsLog::LogType log_type) { |
1209 return base::MakeUnique<MetricsLog>(state_manager_->client_id(), session_id_, | 1209 return base::MakeUnique<MetricsLog>(state_manager_->client_id(), session_id_, |
1210 log_type, client_, local_state_); | 1210 log_type, client_, local_state_); |
1211 } | 1211 } |
1212 | 1212 |
1213 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { | 1213 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { |
1214 DCHECK(client_); | 1214 DCHECK(client_); |
1215 std::vector<variations::ActiveGroupId> synthetic_trials; | 1215 std::vector<variations::ActiveGroupId> synthetic_trials; |
1216 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials); | 1216 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials); |
1217 std::string serialized_environment = log->RecordEnvironment( | 1217 std::string serialized_environment = log->RecordEnvironment( |
1218 metrics_providers_.get(), synthetic_trials, GetInstallDate(), | 1218 metrics_providers_, synthetic_trials, GetInstallDate(), |
1219 GetMetricsReportingEnabledDate()); | 1219 GetMetricsReportingEnabledDate()); |
1220 client_->OnEnvironmentUpdate(&serialized_environment); | 1220 client_->OnEnvironmentUpdate(&serialized_environment); |
1221 } | 1221 } |
1222 | 1222 |
1223 void MetricsService::RecordCurrentHistograms() { | 1223 void MetricsService::RecordCurrentHistograms() { |
1224 DCHECK(log_manager_.current_log()); | 1224 DCHECK(log_manager_.current_log()); |
1225 SCOPED_UMA_HISTOGRAM_TIMER("UMA.MetricsService.RecordCurrentHistograms.Time"); | 1225 SCOPED_UMA_HISTOGRAM_TIMER("UMA.MetricsService.RecordCurrentHistograms.Time"); |
1226 | 1226 |
1227 // "true" to the begin() call indicates that StatisticsRecorder should include | 1227 // "true" to the begin() call indicates that StatisticsRecorder should include |
1228 // histograms held in persistent storage. | 1228 // histograms held in persistent storage. |
1229 histogram_snapshot_manager_.PrepareDeltas( | 1229 histogram_snapshot_manager_.PrepareDeltas( |
1230 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1230 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), |
1231 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); | 1231 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); |
1232 for (MetricsProvider* provider : metrics_providers_) | 1232 for (auto& provider : metrics_providers_) |
1233 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); | 1233 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); |
1234 } | 1234 } |
1235 | 1235 |
1236 void MetricsService::RecordCurrentStabilityHistograms() { | 1236 void MetricsService::RecordCurrentStabilityHistograms() { |
1237 DCHECK(log_manager_.current_log()); | 1237 DCHECK(log_manager_.current_log()); |
1238 // "true" indicates that StatisticsRecorder should include histograms in | 1238 // "true" indicates that StatisticsRecorder should include histograms in |
1239 // persistent storage. | 1239 // persistent storage. |
1240 histogram_snapshot_manager_.PrepareDeltas( | 1240 histogram_snapshot_manager_.PrepareDeltas( |
1241 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1241 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), |
1242 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); | 1242 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); |
1243 for (MetricsProvider* provider : metrics_providers_) | 1243 for (auto& provider : metrics_providers_) |
1244 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); | 1244 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); |
1245 } | 1245 } |
1246 | 1246 |
1247 void MetricsService::LogCleanShutdown(bool end_completed) { | 1247 void MetricsService::LogCleanShutdown(bool end_completed) { |
1248 DCHECK(thread_checker_.CalledOnValidThread()); | 1248 DCHECK(thread_checker_.CalledOnValidThread()); |
1249 // Redundant setting to assure that we always reset this value at shutdown | 1249 // Redundant setting to assure that we always reset this value at shutdown |
1250 // (and that we don't use some alternate path, and not call LogCleanShutdown). | 1250 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
1251 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1251 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
1252 client_->OnLogCleanShutdown(); | 1252 client_->OnLogCleanShutdown(); |
1253 clean_exit_beacon_.WriteBeaconValue(true); | 1253 clean_exit_beacon_.WriteBeaconValue(true); |
1254 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_); | 1254 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_); |
1255 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed); | 1255 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, end_completed); |
1256 } | 1256 } |
1257 | 1257 |
1258 } // namespace metrics | 1258 } // namespace metrics |
OLD | NEW |