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

Unified Diff: chrome/browser/net/predictor.cc

Issue 2082653003: Log predictor database size on startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « chrome/browser/net/predictor.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: chrome/browser/net/predictor.cc
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index e375df45c21697a1cf163a67ddbea5c0ee2f9b55..7dd51e3d1991304a1140b313254be985ef22c609 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -672,6 +672,8 @@ void Predictor::FinalizeInitializationOnIOThread(
DnsPrefetchMotivatedList(startup_urls, UrlInfo::STARTUP_LIST_MOTIVATED);
DeserializeReferrersThenDelete(referral_list);
+
+ LogStartupMetrics();
}
//-----------------------------------------------------------------------------
@@ -1172,6 +1174,20 @@ GURL Predictor::GetHSTSRedirectOnIOThread(const GURL& url) {
return url.ReplaceComponents(replacements);
}
+void Predictor::LogStartupMetrics() {
+ size_t total_bytes = 0;
+ for (const auto& referrer : referrers_) {
+ total_bytes += referrer.first.spec().size();
mmenke 2016/06/20 17:01:24 Could optionally add in in sizeof(ReferrerValue) h
Charlie Harrison 2016/06/20 17:26:37 Isn't that what sizeof(subresource.second) is doin
mmenke 2016/06/20 17:33:52 Sorry, I meant sizeof(Referrer). I find the objec
Charlie Harrison 2016/06/20 17:35:13 Agreed. Hoping to clean this up once we stop using
+ for (const auto& subresource: referrer.second) {
mmenke 2016/06/20 17:01:24 nit: Space before colon
Charlie Harrison 2016/06/20 17:26:37 Done.
+ total_bytes += subresource.first.spec().size();
+ total_bytes += sizeof(subresource.second);
+ }
+ }
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.Predictor.Startup.DBSize", total_bytes, 1,
+ 1000000000, 50);
mmenke 2016/06/20 17:01:24 Suggest reducing this to 10 MB to get a finer brea
Charlie Harrison 2016/06/20 17:26:37 Done.
+}
+
+
// ---------------------- End IO methods. -------------------------------------
//-----------------------------------------------------------------------------
« no previous file with comments | « chrome/browser/net/predictor.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698