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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_service.cc

Issue 2423193003: [NTP Snippets] Add UMA for database load time (Closed)
Patch Set: ms 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 | « components/ntp_snippets/remote/ntp_snippets_service.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/ntp_snippets/remote/ntp_snippets_service.cc
diff --git a/components/ntp_snippets/remote/ntp_snippets_service.cc b/components/ntp_snippets/remote/ntp_snippets_service.cc
index 63b79593e1d0730564daea882de936a42c83adc5..6767c607ce0ad903bed82866138ef8ee74635752 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_service.cc
@@ -213,6 +213,7 @@ NTPSnippetsService::NTPSnippetsService(
// We transition to other states while finalizing the initialization, when the
// database is done loading.
+ database_load_start_ = base::TimeTicks::Now();
database_->LoadSnippets(base::Bind(&NTPSnippetsService::OnDatabaseLoaded,
base::Unretained(this)));
}
@@ -472,6 +473,11 @@ void NTPSnippetsService::OnDatabaseLoaded(NTPSnippet::PtrVector snippets) {
DCHECK(state_ == State::NOT_INITED);
DCHECK(base::ContainsKey(categories_, articles_category_));
+ base::TimeDelta database_load_time =
+ base::TimeTicks::Now() - database_load_start_;
+ UMA_HISTOGRAM_MEDIUM_TIMES("NewTabPage.Snippets.DatabaseLoadTime",
+ database_load_time);
+
NTPSnippet::PtrVector to_delete;
for (std::unique_ptr<NTPSnippet>& snippet : snippets) {
Category snippet_category =
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippets_service.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698