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

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 286063004: Move active field trial API to variations component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 // Adds to ongoing logs. 1159 // Adds to ongoing logs.
1160 log_manager_.current_log()->set_hardware_class(hardware_class_); 1160 log_manager_.current_log()->set_hardware_class(hardware_class_);
1161 1161
1162 // Put incremental data (histogram deltas, and realtime stats deltas) at the 1162 // Put incremental data (histogram deltas, and realtime stats deltas) at the
1163 // end of all log transmissions (initial log handles this separately). 1163 // end of all log transmissions (initial log handles this separately).
1164 // RecordIncrementalStabilityElements only exists on the derived 1164 // RecordIncrementalStabilityElements only exists on the derived
1165 // MetricsLog class. 1165 // MetricsLog class.
1166 MetricsLog* current_log = 1166 MetricsLog* current_log =
1167 static_cast<MetricsLog*>(log_manager_.current_log()); 1167 static_cast<MetricsLog*>(log_manager_.current_log());
1168 DCHECK(current_log); 1168 DCHECK(current_log);
1169 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; 1169 std::vector<variations::ActiveGroupId> synthetic_trials;
1170 GetCurrentSyntheticFieldTrials(&synthetic_trials); 1170 GetCurrentSyntheticFieldTrials(&synthetic_trials);
1171 current_log->RecordEnvironment(plugins_, google_update_metrics_, 1171 current_log->RecordEnvironment(plugins_, google_update_metrics_,
1172 synthetic_trials); 1172 synthetic_trials);
1173 PrefService* pref = g_browser_process->local_state(); 1173 PrefService* pref = g_browser_process->local_state();
1174 base::TimeDelta incremental_uptime; 1174 base::TimeDelta incremental_uptime;
1175 base::TimeDelta uptime; 1175 base::TimeDelta uptime;
1176 GetUptimes(pref, &incremental_uptime, &uptime); 1176 GetUptimes(pref, &incremental_uptime, &uptime);
1177 current_log->RecordStabilityMetrics(incremental_uptime, uptime); 1177 current_log->RecordStabilityMetrics(incremental_uptime, uptime);
1178 1178
1179 RecordCurrentHistograms(); 1179 RecordCurrentHistograms();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 // that they're not lost in case of a crash before upload time. 1445 // that they're not lost in case of a crash before upload time.
1446 log_manager_.PersistUnsentLogs(); 1446 log_manager_.PersistUnsentLogs();
1447 1447
1448 has_initial_stability_log_ = true; 1448 has_initial_stability_log_ = true;
1449 } 1449 }
1450 1450
1451 void MetricsService::PrepareInitialMetricsLog() { 1451 void MetricsService::PrepareInitialMetricsLog() {
1452 DCHECK(state_ == INIT_TASK_DONE || state_ == SENDING_INITIAL_STABILITY_LOG); 1452 DCHECK(state_ == INIT_TASK_DONE || state_ == SENDING_INITIAL_STABILITY_LOG);
1453 initial_metrics_log_->set_hardware_class(hardware_class_); 1453 initial_metrics_log_->set_hardware_class(hardware_class_);
1454 1454
1455 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; 1455 std::vector<variations::ActiveGroupId> synthetic_trials;
1456 GetCurrentSyntheticFieldTrials(&synthetic_trials); 1456 GetCurrentSyntheticFieldTrials(&synthetic_trials);
1457 initial_metrics_log_->RecordEnvironment(plugins_, google_update_metrics_, 1457 initial_metrics_log_->RecordEnvironment(plugins_, google_update_metrics_,
1458 synthetic_trials); 1458 synthetic_trials);
1459 PrefService* pref = g_browser_process->local_state(); 1459 PrefService* pref = g_browser_process->local_state();
1460 base::TimeDelta incremental_uptime; 1460 base::TimeDelta incremental_uptime;
1461 base::TimeDelta uptime; 1461 base::TimeDelta uptime;
1462 GetUptimes(pref, &incremental_uptime, &uptime); 1462 GetUptimes(pref, &incremental_uptime, &uptime);
1463 initial_metrics_log_->RecordStabilityMetrics(incremental_uptime, uptime); 1463 initial_metrics_log_->RecordStabilityMetrics(incremental_uptime, uptime);
1464 1464
1465 // Histograms only get written to the current log, so make the new log current 1465 // Histograms only get written to the current log, so make the new log current
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 SyntheticTrialGroup trial_group = trial; 1720 SyntheticTrialGroup trial_group = trial;
1721 trial_group.start_time = base::TimeTicks::Now(); 1721 trial_group.start_time = base::TimeTicks::Now();
1722 synthetic_trial_groups_.push_back(trial_group); 1722 synthetic_trial_groups_.push_back(trial_group);
1723 } 1723 }
1724 1724
1725 void MetricsService::CheckForClonedInstall() { 1725 void MetricsService::CheckForClonedInstall() {
1726 state_manager_->CheckForClonedInstall(); 1726 state_manager_->CheckForClonedInstall();
1727 } 1727 }
1728 1728
1729 void MetricsService::GetCurrentSyntheticFieldTrials( 1729 void MetricsService::GetCurrentSyntheticFieldTrials(
1730 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials) { 1730 std::vector<variations::ActiveGroupId>* synthetic_trials) {
1731 DCHECK(synthetic_trials); 1731 DCHECK(synthetic_trials);
1732 synthetic_trials->clear(); 1732 synthetic_trials->clear();
1733 const MetricsLog* current_log = 1733 const MetricsLog* current_log =
1734 static_cast<const MetricsLog*>(log_manager_.current_log()); 1734 static_cast<const MetricsLog*>(log_manager_.current_log());
1735 for (size_t i = 0; i < synthetic_trial_groups_.size(); ++i) { 1735 for (size_t i = 0; i < synthetic_trial_groups_.size(); ++i) {
1736 if (synthetic_trial_groups_[i].start_time <= current_log->creation_time()) 1736 if (synthetic_trial_groups_[i].start_time <= current_log->creation_time())
1737 synthetic_trials->push_back(synthetic_trial_groups_[i].id); 1737 synthetic_trials->push_back(synthetic_trial_groups_[i].id);
1738 } 1738 }
1739 } 1739 }
1740 1740
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 if (metrics_service) 1962 if (metrics_service)
1963 metrics_service->AddObserver(observer); 1963 metrics_service->AddObserver(observer);
1964 } 1964 }
1965 1965
1966 void MetricsServiceHelper::RemoveMetricsServiceObserver( 1966 void MetricsServiceHelper::RemoveMetricsServiceObserver(
1967 MetricsServiceObserver* observer) { 1967 MetricsServiceObserver* observer) {
1968 MetricsService* metrics_service = g_browser_process->metrics_service(); 1968 MetricsService* metrics_service = g_browser_process->metrics_service();
1969 if (metrics_service) 1969 if (metrics_service)
1970 metrics_service->RemoveObserver(observer); 1970 metrics_service->RemoveObserver(observer);
1971 } 1971 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698