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

Unified Diff: components/history/core/browser/top_sites_backend.cc

Issue 1018713002: Record the time to update top sites through db thread to understand if this is low and how slow it … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uses timeticks instead of time. Created 5 years, 9 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/history/core/browser/top_sites_backend.cc
diff --git a/components/history/core/browser/top_sites_backend.cc b/components/history/core/browser/top_sites_backend.cc
index 97fa8487f53441cde2dcc595aca41eefa4f64307..2383c1c9d213510dc217bc28465667d05dda2392 100644
--- a/components/history/core/browser/top_sites_backend.cc
+++ b/components/history/core/browser/top_sites_backend.cc
@@ -9,8 +9,11 @@
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
+#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
#include "base/task/cancelable_task_tracker.h"
+#include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
#include "components/history/core/browser/top_sites_database.h"
#include "sql/connection.h"
@@ -99,9 +102,15 @@ void TopSitesBackend::GetMostVisitedThumbnailsOnDBThread(
}
void TopSitesBackend::UpdateTopSitesOnDBThread(const TopSitesDelta& delta) {
+ TRACE_EVENT0("startup", "history::TopSitesBackend::UpdateTopSitesOnDBThread");
+
if (!db_)
return;
+ // TODO(yiyaoliu): Remove the histogram and related code when crbug/223430 is
+ // fixed.
+ base::TimeTicks begin_time = base::TimeTicks::Now();
sky 2015/03/27 15:51:04 I was looking at TimeTicks and wonder if you shoul
+
for (size_t i = 0; i < delta.deleted.size(); ++i)
db_->RemoveURL(delta.deleted[i]);
@@ -110,6 +119,9 @@ void TopSitesBackend::UpdateTopSitesOnDBThread(const TopSitesDelta& delta) {
for (size_t i = 0; i < delta.moved.size(); ++i)
db_->UpdatePageRank(delta.moved[i].url, delta.moved[i].rank);
+
+ UMA_HISTOGRAM_TIMES("History.UpdateTopSitesOnDBThreadTime",
+ base::TimeTicks::Now() - begin_time);
}
void TopSitesBackend::SetPageThumbnailOnDBThread(const MostVisitedURL& url,
« 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