Commit 88aa9330 authored by asvitkine's avatar asvitkine Committed by Commit bot

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}
parent 6ecefe38
......@@ -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(
......
......@@ -364,6 +364,9 @@ class MetricsService : public base::HistogramFlattener {
// Creates a new MetricsLog instance with the given |log_type|.
scoped_ptr<MetricsLog> CreateLog(MetricsLog::LogType log_type);
// Records the current environment (system profile) in |log|.
void RecordCurrentEnvironment(MetricsLog* log);
// Record complete list of histograms into the current log.
// Called when we close a log.
void RecordCurrentHistograms();
......
......@@ -35618,6 +35618,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="UMA.SyntheticTrials.Count">
<owner>asvitkine@chromium.org</owner>
<summary>
The number of synthetic field trials added to the UMA log when the system
profile is recorded. Since this is done prior to capturing the histograms
from the current process, this will generally be logged once per UMA log.
</summary>
</histogram>
<histogram name="UMA.Unacceptable_Log_Discarded">
<obsolete>
Deprecated as of May, 2012 (i.e. Chrome 21+). Replaced by the
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment