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

Unified Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 148323002: Add histograms to ResourceFetcher to evaluate memory cache hit rate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@histogram-unload-frequency
Patch Set: Switched to a helper class Created 6 years, 11 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 | « Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index ea44911232428333aea6d34d69eedae383194cb6..66c9e0ff0f3bdd089fa1095f2e7ab6c4536c71bd 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -632,6 +632,9 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc
break;
}
+ if (!resource->hasClients())
Nate Chapin 2014/01/29 18:19:56 We null-check resource just below this. Either thi
+ m_deadStatsRecorder.update(policy);
+
if (!resource)
return 0;
@@ -1373,4 +1376,38 @@ const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions()
return options;
}
+ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder()
+ : m_useCount(0)
+ , m_revalidateCount(0)
+ , m_loadCount(0)
+{
+}
+
+ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder()
+{
+ blink::Platform::current()->histogramCustomCounts(
+ "WebCore.ResourceFetcher.HitCount", m_useCount, 0, 1000, 50);
+ blink::Platform::current()->histogramCustomCounts(
+ "WebCore.ResourceFetcher.RevalidateCount", m_revalidateCount, 0, 1000, 50);
+ blink::Platform::current()->histogramCustomCounts(
+ "WebCore.ResourceFetcher.LoadCount", m_loadCount, 0, 1000, 50);
+}
+
+void ResourceFetcher::DeadResourceStatsRecorder::update(RevalidationPolicy policy)
+{
+ switch (policy) {
+ case Reload:
+ // Fall through.
Nate Chapin 2014/01/29 18:19:56 Given that Reload and Load cases are identical, th
+ case Load:
+ ++m_loadCount;
+ break;
Nate Chapin 2014/01/29 18:19:56 return instead?
+ case Revalidate:
+ ++m_revalidateCount;
+ break;
+ case Use:
+ ++m_useCount;
+ break;
+ }
+}
+
}
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698