summaryrefslogtreecommitdiffstats
path: root/components/metrics/metrics_service.cc
diff options
context:
space:
mode:
authorasvitkine <asvitkine@chromium.org>2014-09-29 16:29:17 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-29 23:34:44 +0000
commit88aa9330b9dcc79911d607c5d7156d5345d69633 (patch)
tree195bc4c5531bac036a0e59ae06bb2fa4fbedf74f /components/metrics/metrics_service.cc
parent6ecefe38d8762473839f797a6abb98c5eb66a1b7 (diff)
downloadchromium_src-88aa9330b9dcc79911d607c5d7156d5345d69633.zip
chromium_src-88aa9330b9dcc79911d607c5d7156d5345d69633.tar.gz
chromium_src-88aa9330b9dcc79911d607c5d7156d5345d69633.tar.bz2
Add a histogram to measure number of synthetic UMA trials.
Also refactors some common code into a method in MetricsService. BUG=400357 Review URL: https://codereview.chromium.org/612883003 Cr-Commit-Position: refs/heads/master@{#297302}
Diffstat (limited to 'components/metrics/metrics_service.cc')
-rw-r--r--components/metrics/metrics_service.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 25240a2..35dd927 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -766,10 +766,7 @@ void MetricsService::CloseCurrentLog() {
// MetricsLog class.
MetricsLog* current_log = log_manager_.current_log();
DCHECK(current_log);
- std::vector<variations::ActiveGroupId> synthetic_trials;
- GetCurrentSyntheticFieldTrials(&synthetic_trials);
- current_log->RecordEnvironment(
- metrics_providers_.get(), synthetic_trials, GetInstallDate());
+ RecordCurrentEnvironment(current_log);
base::TimeDelta incremental_uptime;
base::TimeDelta uptime;
GetUptimes(local_state_, &incremental_uptime, &uptime);
@@ -972,11 +969,7 @@ void MetricsService::PrepareInitialStabilityLog() {
void MetricsService::PrepareInitialMetricsLog() {
DCHECK(state_ == INIT_TASK_DONE || state_ == SENDING_INITIAL_STABILITY_LOG);
- std::vector<variations::ActiveGroupId> synthetic_trials;
- GetCurrentSyntheticFieldTrials(&synthetic_trials);
- initial_metrics_log_->RecordEnvironment(metrics_providers_.get(),
- synthetic_trials,
- GetInstallDate());
+ RecordCurrentEnvironment(initial_metrics_log_.get());
base::TimeDelta incremental_uptime;
base::TimeDelta uptime;
GetUptimes(local_state_, &incremental_uptime, &uptime);
@@ -1177,6 +1170,15 @@ scoped_ptr<MetricsLog> MetricsService::CreateLog(MetricsLog::LogType log_type) {
local_state_));
}
+void MetricsService::RecordCurrentEnvironment(MetricsLog* log) {
+ std::vector<variations::ActiveGroupId> synthetic_trials;
+ GetCurrentSyntheticFieldTrials(&synthetic_trials);
+ log->RecordEnvironment(metrics_providers_.get(), synthetic_trials,
+ GetInstallDate());
+ UMA_HISTOGRAM_COUNTS_100("UMA.SyntheticTrials.Count",
+ synthetic_trials.size());
+}
+
void MetricsService::RecordCurrentHistograms() {
DCHECK(log_manager_.current_log());
histogram_snapshot_manager_.PrepareDeltas(