Index: components/offline_pages/background/request_coordinator.cc |
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc |
index d1d380b005043d4a541073c48f6832a005653476..290ae155f2e08ee700e3d5f0dcc40ef1aa798de2 100644 |
--- a/components/offline_pages/background/request_coordinator.cc |
+++ b/components/offline_pages/background/request_coordinator.cc |
@@ -74,6 +74,19 @@ void RecordOfflinerResultUMA(const ClientId& client_id, |
} |
} |
+void RecordStartTimeUMA(const SavePageRequest& request) { |
+ std::string histogram_name("OfflinePages.Background.TimeToStart"); |
+ if (base::SysInfo::IsLowEndDevice()) { |
+ histogram_name += ".Svelte"; |
+ } |
+ |
+ base::TimeDelta duration = base::Time::Now() - request.creation_time(); |
+ UMA_HISTOGRAM_CUSTOM_TIMES( |
Steven Holte
2016/10/20 20:51:11
Also you shouldn't use this macro with a computed
dougarnett
2016/10/21 16:13:48
Done. Thanks
|
+ AddHistogramSuffix(request.client_id(), histogram_name.c_str()), duration, |
+ base::TimeDelta::FromMilliseconds(100), |
+ base::TimeDelta::FromSeconds(kMaxDurationSeconds), kDurationBuckets); |
Steven Holte
2016/10/20 20:46:31
You don't want this bound to change even if you ch
dougarnett
2016/10/21 16:13:48
Done.
|
+} |
+ |
void RecordCancelTimeUMA(const SavePageRequest& canceled_request) { |
// Using regular histogram (with dynamic suffix) rather than time-oriented |
// one to record samples in seconds rather than milliseconds. |
@@ -547,6 +560,11 @@ void RequestCoordinator::SendRequestToOffliner(const SavePageRequest& request) { |
DCHECK(!is_busy_); |
is_busy_ = true; |
+ // Record start time if this is first attempt. |
+ if (request.started_attempt_count() == 0) { |
+ RecordStartTimeUMA(request); |
+ } |
+ |
// Mark attempt started in the database and start offliner when completed. |
queue_->MarkAttemptStarted( |
request.request_id(), |