[WK2] Log total number of network cache queries using diagnostic logging
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2015 07:27:53 +0000 (07:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2015 07:27:53 +0000 (07:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142803
<rdar://problem/19632130>

Reviewed by Antti Koivisto.

Source/WebCore:

Add diagnostic logging key needed for network efficacy logging.

* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::retrievalRequestKey):
* page/DiagnosticLoggingKeys.h:

Source/WebKit2:

Log total number of network cache queries using diagnostic logging.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
* NetworkProcess/cache/NetworkCacheStatistics.h:
* NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
(WebKit::NetworkCache::Statistics::recordCacheRetrievalRequest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181689 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/DiagnosticLoggingKeys.cpp
Source/WebCore/page/DiagnosticLoggingKeys.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm

index 2113272..558043b 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-18  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] Log total number of network cache queries using diagnostic logging
+        https://bugs.webkit.org/show_bug.cgi?id=142803
+        <rdar://problem/19632130>
+
+        Reviewed by Antti Koivisto.
+
+        Add diagnostic logging key needed for network efficacy logging.
+
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::retrievalRequestKey):
+        * page/DiagnosticLoggingKeys.h:
+
 2015-03-18  Tim Horton  <timothy_horton@apple.com>
 
         Fix the build after r181660
index 81e9f0d..6321ad9 100644 (file)
@@ -313,6 +313,11 @@ String DiagnosticLoggingKeys::reloadKey()
     return ASCIILiteral("reload");
 }
 
+String DiagnosticLoggingKeys::retrievalRequestKey()
+{
+    return ASCIILiteral("retrievalRequest");
+}
+
 String DiagnosticLoggingKeys::resourceKey()
 {
     return ASCIILiteral("resource");
index d441aad..11b434b 100644 (file)
@@ -99,6 +99,7 @@ public:
     static String resourceRequestKey();
     static String resourceResponseKey();
     WEBCORE_EXPORT static String retrievalKey();
+    WEBCORE_EXPORT static String retrievalRequestKey();
     static String revalidatingKey();
     static String sameLoadKey();
     static String scriptKey();
index 825fb46..808ac8b 100644 (file)
@@ -1,5 +1,21 @@
 2015-03-18  Chris Dumez  <cdumez@apple.com>
 
+        [WK2] Log total number of network cache queries using diagnostic logging
+        https://bugs.webkit.org/show_bug.cgi?id=142803
+        <rdar://problem/19632130>
+
+        Reviewed by Antti Koivisto.
+
+        Log total number of network cache queries using diagnostic logging.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::Cache::retrieve):
+        * NetworkProcess/cache/NetworkCacheStatistics.h:
+        * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
+        (WebKit::NetworkCache::Statistics::recordCacheRetrievalRequest):
+
+2015-03-18  Chris Dumez  <cdumez@apple.com>
+
         [WK2] We should not even try the network cache for non-HTTP protocol requests
         https://bugs.webkit.org/show_bug.cgi?id=142802
         <rdar://problem/19632130>
index b2f3661..613db69 100644 (file)
@@ -263,6 +263,9 @@ void Cache::retrieve(const WebCore::ResourceRequest& originalRequest, uint64_t w
 
     LOG(NetworkCache, "(NetworkProcess) retrieving %s priority %u", originalRequest.url().string().ascii().data(), originalRequest.priority());
 
+    if (m_statistics)
+        m_statistics->recordRetrievalRequest(webPageID);
+
     Key storageKey = makeCacheKey(originalRequest);
     RetrieveDecision retrieveDecision = canRetrieve(originalRequest);
     if (retrieveDecision != RetrieveDecision::Yes) {
index d024a24..c491ef8 100644 (file)
@@ -47,6 +47,7 @@ public:
 
     void clear();
 
+    void recordRetrievalRequest(uint64_t webPageID);
     void recordNotCachingResponse(const Key&, StoreDecision);
     void recordNotUsingCacheForRequest(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, RetrieveDecision);
     void recordRetrievalFailure(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&);
index 74f6e8f..fe5c658 100644 (file)
@@ -178,6 +178,11 @@ void Statistics::shrinkIfNeeded()
     });
 }
 
+void Statistics::recordRetrievalRequest(uint64_t webPageID)
+{
+    NetworkProcess::singleton().logDiagnosticMessage(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalRequestKey(), WebCore::ShouldSample::Yes);
+}
+
 void Statistics::recordNotCachingResponse(const Key& key, StoreDecision storeDecision)
 {
     ASSERT(storeDecision != StoreDecision::Yes);