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

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: Update histogram desc 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..10149461984c421a040995e2721cf0241fd94754 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,21 @@ 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();
+ total_bytes += sizeof(Referrer);
+ for (const auto& subresource : referrer.second) {
+ total_bytes += subresource.first.spec().size();
+ total_bytes += sizeof(ReferrerValue);
+ }
+ }
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.Predictor.Startup.DBSize", total_bytes, 1,
+ 10 * 1000 * 1000, 50);
+}
+
+
// ---------------------- 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