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

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

Issue 2918533003: Send metrics with embedded system profiles after system startup. (Closed)
Patch Set: load profile from only the first found source Created 3 years, 6 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
« no previous file with comments | « components/metrics/metrics_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 bool MetricsService::PrepareInitialStabilityLog( 776 bool MetricsService::PrepareInitialStabilityLog(
777 const std::string& prefs_previous_version) { 777 const std::string& prefs_previous_version) {
778 DCHECK_EQ(INITIALIZED, state_); 778 DCHECK_EQ(INITIALIZED, state_);
779 779
780 std::unique_ptr<MetricsLog> initial_stability_log( 780 std::unique_ptr<MetricsLog> initial_stability_log(
781 CreateLog(MetricsLog::INITIAL_STABILITY_LOG)); 781 CreateLog(MetricsLog::INITIAL_STABILITY_LOG));
782 782
783 // Do not call NotifyOnDidCreateMetricsLog here because the stability 783 // Do not call NotifyOnDidCreateMetricsLog here because the stability
784 // log describes stats from the _previous_ session. 784 // log describes stats from the _previous_ session.
785 std::string system_profile_app_version; 785 std::string system_profile_app_version;
786 if (!initial_stability_log->LoadSavedEnvironmentFromPrefs( 786 for (auto& provider : metrics_providers_) {
787 &system_profile_app_version)) { 787 if (initial_stability_log->LoadSavedEnvironmentFromProvider(
788 return false; 788 provider.get(), &system_profile_app_version)) {
Alexei Svitkine (slow) 2017/05/31 20:31:24 Instead of replacing the profile of the stability
bcwhite 2017/05/31 20:48:29 Currently there is only ever one persistent histog
Alexei Svitkine (slow) 2017/06/01 15:00:29 Per offline discussion, I prefer to not have this
789 break;
790 }
791 }
792 if (system_profile_app_version.empty()) {
793 if (!initial_stability_log->LoadSavedEnvironmentFromPrefs(
794 &system_profile_app_version)) {
795 return false;
796 }
789 } 797 }
790 if (system_profile_app_version != prefs_previous_version) 798 if (system_profile_app_version != prefs_previous_version)
791 StabilityMetricsProvider(local_state_).LogStabilityVersionMismatch(); 799 StabilityMetricsProvider(local_state_).LogStabilityVersionMismatch();
792 800
793 log_manager_.PauseCurrentLog(); 801 log_manager_.PauseCurrentLog();
794 log_manager_.BeginLoggingWithLog(std::move(initial_stability_log)); 802 log_manager_.BeginLoggingWithLog(std::move(initial_stability_log));
795 803
796 // Note: Some stability providers may record stability stats via histograms, 804 // Note: Some stability providers may record stability stats via histograms,
797 // so this call has to be after BeginLoggingWithLog(). 805 // so this call has to be after BeginLoggingWithLog().
798 log_manager_.current_log()->RecordStabilityMetrics( 806 log_manager_.current_log()->RecordStabilityMetrics(
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 // Redundant setting to assure that we always reset this value at shutdown 1001 // Redundant setting to assure that we always reset this value at shutdown
994 // (and that we don't use some alternate path, and not call LogCleanShutdown). 1002 // (and that we don't use some alternate path, and not call LogCleanShutdown).
995 clean_shutdown_status_ = CLEANLY_SHUTDOWN; 1003 clean_shutdown_status_ = CLEANLY_SHUTDOWN;
996 client_->OnLogCleanShutdown(); 1004 client_->OnLogCleanShutdown();
997 clean_exit_beacon_.WriteBeaconValue(true); 1005 clean_exit_beacon_.WriteBeaconValue(true);
998 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_); 1006 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_);
999 StabilityMetricsProvider(local_state_).MarkSessionEndCompleted(end_completed); 1007 StabilityMetricsProvider(local_state_).MarkSessionEndCompleted(end_completed);
1000 } 1008 }
1001 1009
1002 } // namespace metrics 1010 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698