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

Unified Diff: components/offline_pages/offline_page_model.cc

Issue 1950423006: Offline Pages: Add Model Load Time UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename metrics for more precision. Created 4 years, 7 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/offline_pages/offline_page_model.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/offline_pages/offline_page_model.cc
diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc
index 1cbd15a797e2d217c55815589eef607228215ee4..19d32cf5cac38dd44245e8c94c06f8c128621790 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -119,7 +119,7 @@ OfflinePageModel::OfflinePageModel(
task_runner_->PostTaskAndReply(
FROM_HERE, base::Bind(EnsureArchivesDirCreated, archives_dir_),
base::Bind(&OfflinePageModel::OnEnsureArchivesDirCreatedDone,
- weak_ptr_factory_.GetWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr(), base::TimeTicks::Now()));
}
OfflinePageModel::~OfflinePageModel() {
@@ -574,12 +574,17 @@ void OfflinePageModel::OnMarkPageAccesseDone(
// should not have any impact to the UI.
}
-void OfflinePageModel::OnEnsureArchivesDirCreatedDone() {
+void OfflinePageModel::OnEnsureArchivesDirCreatedDone(
+ const base::TimeTicks& start_time) {
+ UMA_HISTOGRAM_TIMES("OfflinePages.Model.ArchiveDirCreationTime",
+ base::TimeTicks::Now() - start_time);
+
store_->Load(base::Bind(&OfflinePageModel::OnLoadDone,
- weak_ptr_factory_.GetWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr(), start_time));
}
void OfflinePageModel::OnLoadDone(
+ const base::TimeTicks& start_time,
OfflinePageMetadataStore::LoadStatus load_status,
const std::vector<OfflinePageItem>& offline_pages) {
DCHECK(!is_loaded_);
@@ -590,6 +595,9 @@ void OfflinePageModel::OnLoadDone(
if (load_status == OfflinePageMetadataStore::LOAD_SUCCEEDED)
CacheLoadedData(offline_pages);
+ UMA_HISTOGRAM_TIMES("OfflinePages.Model.ConstructionToLoadedEventTime",
+ base::TimeTicks::Now() - start_time);
+
// Run all the delayed tasks.
for (const auto& delayed_task : delayed_tasks_)
delayed_task.Run();
« no previous file with comments | « components/offline_pages/offline_page_model.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698