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

Unified Diff: components/metrics/metrics_reporting_scheduler.cc

Issue 633373011: Histogram for recording actual log upload interval added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: space fix Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/metrics/metrics_reporting_scheduler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..53c0cc553f26bac20f89bc18339caadd4d01ef60 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(12).InMinutes(),
+ 50);
+}
+
// 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.
@@ -126,6 +134,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 +161,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_ = base::TimeTicks();
+ }
+
callback_pending_ = true;
upload_callback_.Run();
}
« no previous file with comments | « components/metrics/metrics_reporting_scheduler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698