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

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: Add units to metric descriptions. 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
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..70a7e405627a22339e0b95fce2d7bb2721a10896 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.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.ModelLoadTime",
+ base::TimeTicks::Now() - start_time);
+
// Run all the delayed tasks.
for (const auto& delayed_task : delayed_tasks_)
delayed_task.Run();

Powered by Google App Engine
This is Rietveld 408576698