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

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: 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 b79496ad978b14ac2c5678920b110412760b29fe..f21d2ff44b0204f039f8db6e6cf9bfcda4d5bae7 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -225,6 +225,9 @@ ResourceFetcher::ResourceFetcher(DocumentLoader* documentLoader)
, m_requestCount(0)
, m_garbageCollectDocumentResourcesTimer(this, &ResourceFetcher::garbageCollectDocumentResourcesTimerFired)
, m_resourceTimingReportTimer(this, &ResourceFetcher::resourceTimingReportTimerFired)
+ , m_useCount(0)
+ , m_revalidateCount(0)
+ , m_loadCount(0)
, m_autoLoadImages(true)
, m_imagesEnabled(true)
, m_allowStaleResources(false)
@@ -238,6 +241,13 @@ ResourceFetcher::~ResourceFetcher()
clearPreloads();
+ 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);
+
// Make sure no requests still point to this ResourceFetcher
ASSERT(!m_requestCount);
}
@@ -629,13 +639,18 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc
// Fall through
case Load:
resource = loadResource(type, request, request.charset());
+ ++m_loadCount;
Nate Chapin 2014/01/28 20:22:54 Would it be cleaner to wrap these variables up int
clamy 2014/01/29 12:19:21 Done.
break;
case Revalidate:
resource = revalidateResource(request, resource.get());
+ if (!resource->hasClients())
+ ++m_revalidateCount;
break;
case Use:
resource->updateForAccess();
notifyLoadedFromMemoryCache(resource.get());
+ if (!resource->hasClients())
+ ++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