summaryrefslogtreecommitdiffstats
path: root/components/metrics
diff options
context:
space:
mode:
authorholte <holte@chromium.org>2014-10-09 11:38:52 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-09 18:39:09 +0000
commitd1843d4809b122fcd440c021750f532b544b9970 (patch)
tree0f07c58acdbfba30cd43bddb9de1237c229c9cc0 /components/metrics
parent981f132f9f354a9c3cd1bb45bb1f95f8d006f5fa (diff)
downloadchromium_src-d1843d4809b122fcd440c021750f532b544b9970.zip
chromium_src-d1843d4809b122fcd440c021750f532b544b9970.tar.gz
chromium_src-d1843d4809b122fcd440c021750f532b544b9970.tar.bz2
Create field trial to test the impact of changing the upload/creation timing of the initial metrics logs.
This experiment changes the timing of two steps in the process of creating the initial metrics log, when we chrome starts after an unclean shutdown. First, we now create the initial metrics log at the same time as we would when there is no stability log to send, instead of waiting for that log to be finished sending. Second, instead of bypassing the scheduler, we wait the normal interval between consecutive uploads for queued logs before beginning the upload (3s on mobile, 15s on desktop). The behavior when starting from a clean shutdown is unchanged. BUG=410493,412007 Review URL: https://codereview.chromium.org/537663003 Cr-Commit-Position: refs/heads/master@{#298943}
Diffstat (limited to 'components/metrics')
-rw-r--r--components/metrics/metrics_service.cc48
1 files changed, 36 insertions, 12 deletions
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 35dd927..b6bb8f5 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -254,6 +254,11 @@ ResponseStatus ResponseCodeToStatus(int response_code) {
}
}
+bool NewInitialMetricsTimingEnabled() {
+ return base::FieldTrialList::FindFullName("UMAInitialMetricsTiming") ==
+ "Enabled";
+}
+
void MarkAppCleanShutdownAndCommit(CleanExitBeacon* clean_exit_beacon,
PrefService* local_state) {
clean_exit_beacon->WriteBeaconValue(true);
@@ -893,14 +898,30 @@ void MetricsService::StageNewLog() {
return;
case INIT_TASK_DONE:
- if (has_initial_stability_log_) {
- // There's an initial stability log, ready to send.
+ if (NewInitialMetricsTimingEnabled()) {
+ PrepareInitialMetricsLog();
+ // Stage the first log, which could be a stability log (either one
+ // for created in this session or from a previous session) or the
+ // initial metrics log that was just created.
log_manager_.StageNextLogForUpload();
- has_initial_stability_log_ = false;
- state_ = SENDING_INITIAL_STABILITY_LOG;
+ if (has_initial_stability_log_) {
+ // The initial stability log was just staged.
+ has_initial_stability_log_ = false;
+ state_ = SENDING_INITIAL_STABILITY_LOG;
+ } else {
+ state_ = SENDING_INITIAL_METRICS_LOG;
+ }
} else {
- PrepareInitialMetricsLog();
- state_ = SENDING_INITIAL_METRICS_LOG;
+ if (has_initial_stability_log_) {
+ // There's an initial stability log, ready to send.
+ log_manager_.StageNextLogForUpload();
+ has_initial_stability_log_ = false;
+ state_ = SENDING_INITIAL_STABILITY_LOG;
+ } else {
+ PrepareInitialMetricsLog();
+ log_manager_.StageNextLogForUpload();
+ state_ = SENDING_INITIAL_METRICS_LOG;
+ }
}
break;
@@ -994,9 +1015,6 @@ void MetricsService::PrepareInitialMetricsLog() {
// Store unsent logs, including the initial log that was just saved, so
// that they're not lost in case of a crash before upload time.
log_manager_.PersistUnsentLogs();
-
- DCHECK(!log_manager_.has_staged_log());
- log_manager_.StageNextLogForUpload();
}
void MetricsService::SendStagedLog() {
@@ -1065,9 +1083,15 @@ void MetricsService::OnLogUploadComplete(int response_code) {
if (!log_manager_.has_staged_log()) {
switch (state_) {
case SENDING_INITIAL_STABILITY_LOG:
- PrepareInitialMetricsLog();
- SendStagedLog();
- state_ = SENDING_INITIAL_METRICS_LOG;
+ if (NewInitialMetricsTimingEnabled()) {
+ // The initial metrics log is already in the queue of unsent logs.
+ state_ = SENDING_OLD_LOGS;
+ } else {
+ PrepareInitialMetricsLog();
+ log_manager_.StageNextLogForUpload();
+ SendStagedLog();
+ state_ = SENDING_INITIAL_METRICS_LOG;
+ }
break;
case SENDING_INITIAL_METRICS_LOG: