Chromium Code Reviews| Index: components/metrics/metrics_reporting_scheduler.cc |
| diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc |
| index faf5c623ab4e75a350883e0a84969051fd2a2674..366ce71576c7d4c5b94068f96b7ea41f492e6819 100644 |
| --- a/components/metrics/metrics_reporting_scheduler.cc |
| +++ b/components/metrics/metrics_reporting_scheduler.cc |
| @@ -62,6 +62,14 @@ void LogMetricsInitSequence(InitSequence sequence) { |
| INIT_SEQUENCE_ENUM_SIZE); |
| } |
| +void LogActualUploadInterval(TimeDelta interval) { |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("UMA.ActualLogUploadInterval", |
| + interval.InMinutes(), |
| + 1, |
| + base::TimeDelta::FromHours(4).InMinutes(), |
|
Alexei Svitkine (slow)
2014/10/15 20:44:19
Let's make this longer to ensure we catch any outl
gayane -on leave until 09-2017
2014/10/15 21:02:00
Done.
|
| + 100); |
|
Alexei Svitkine (slow)
2014/10/15 20:44:19
Let's use 50 buckets - I'm not convinced we need 1
gayane -on leave until 09-2017
2014/10/15 21:02:00
Done.
|
| +} |
| + |
| // Returns upload interval specified for the current experiment running. |
| // TODO(gayane): Only for experimenting with upload interval for Android |
| // (bug: 17391128). Should be removed once the experiments are done. |
| @@ -81,6 +89,7 @@ MetricsReportingScheduler::MetricsReportingScheduler( |
| const base::Closure& upload_callback) |
| : upload_callback_(upload_callback), |
| upload_interval_(TimeDelta::FromSeconds(kInitialUploadIntervalSeconds)), |
| + last_upload_finish_time_(), |
|
Alexei Svitkine (slow)
2014/10/15 20:44:19
This line is not necessary if there's a default ct
gayane -on leave until 09-2017
2014/10/15 21:02:00
Done.
|
| running_(false), |
| callback_pending_(false), |
| init_task_complete_(false), |
| @@ -126,6 +135,7 @@ void MetricsReportingScheduler::UploadFinished(bool server_is_healthy, |
| upload_interval_ = TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); |
| } else { |
| upload_interval_ = GetStandardUploadInterval(); |
| + last_upload_finish_time_ = base::TimeTicks::Now(); |
| } |
| if (running_) |
| @@ -152,6 +162,12 @@ void MetricsReportingScheduler::TriggerUpload() { |
| waiting_for_init_task_complete_ = true; |
| return; |
| } |
| + |
| + if (!last_upload_finish_time_.is_null()) { |
| + LogActualUploadInterval(base::TimeTicks::Now() - last_upload_finish_time_); |
| + last_upload_finish_time_.FromInternalValue(0); |
|
Alexei Svitkine (slow)
2014/10/15 20:44:19
FromInternalValue is a static method that returns
gayane -on leave until 09-2017
2014/10/15 21:02:00
Done.
|
| + } |
| + |
| callback_pending_ = true; |
| upload_callback_.Run(); |
| } |