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

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

Issue 2440733002: [OfflinePages] Adds TimeToStart UMA for background load requests. (Closed)
Patch Set: Inlined histogram constants 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..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(),
« 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