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..d336004dc258cad5a53f52f3849f9ba179c5c609 100644 |
--- a/components/offline_pages/background/request_coordinator.cc |
+++ b/components/offline_pages/background/request_coordinator.cc |
@@ -74,6 +74,23 @@ 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"; |
+ } |
+ |
+ // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_TIMES |
+ // macro adapted to allow for a dynamically suffixed histogram name. |
+ // Note: The factory creates and owns the histogram. |
+ base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( |
+ AddHistogramSuffix(request.client_id(), histogram_name.c_str()), |
+ base::TimeDelta::FromMilliseconds(100), base::TimeDelta::FromDays(7), 50, |
Dmitry Titov
2016/10/21 18:30:25
This will have second bucket that would take every
dougarnett
2016/10/21 23:16:38
I thought this one would give exponential buckets
dougarnett
2016/10/21 23:28:52
Code doc here: https://cs.chromium.org/chromium/sr
|
+ base::HistogramBase::kUmaTargetedHistogramFlag); |
+ base::TimeDelta duration = base::Time::Now() - request.creation_time(); |
+ histogram->AddTime(duration); |
+} |
+ |
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 +564,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(), |