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

Unified Diff: components/offline_pages/background/request_coordinator.cc

Issue 2440733002: [OfflinePages] Adds TimeToStart UMA for background load requests. (Closed)
Patch Set: Created 4 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(),
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698