Diff
Modified: trunk/Source/WebCore/ChangeLog (183080 => 183081)
--- trunk/Source/WebCore/ChangeLog 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebCore/ChangeLog 2015-04-21 23:20:32 UTC (rev 183081)
@@ -1,3 +1,17 @@
+2015-04-21 Chris Dumez <cdu...@apple.com>
+
+ [WK2][NetworkCache] Better account of resource revalidations in efficacy logging
+ https://bugs.webkit.org/show_bug.cgi?id=144014
+
+ Reviewed by Antti Koivisto.
+
+ Add additional diagnostic logging key for network cache efficacy
+ logging.
+
+ * page/DiagnosticLoggingKeys.cpp:
+ (WebCore::DiagnosticLoggingKeys::needsRevalidationKey):
+ * page/DiagnosticLoggingKeys.h:
+
2015-04-21 Brent Fulgham <bfulg...@apple.com>
Context menu doesn't account for selection semantics
Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp (183080 => 183081)
--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp 2015-04-21 23:20:32 UTC (rev 183081)
@@ -103,6 +103,11 @@
return ASCIILiteral("navigation");
}
+String DiagnosticLoggingKeys::needsRevalidationKey()
+{
+ return ASCIILiteral("needsRevalidation");
+}
+
String DiagnosticLoggingKeys::networkCacheKey()
{
return ASCIILiteral("networkCache");
Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.h (183080 => 183081)
--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.h 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.h 2015-04-21 23:20:32 UTC (rev 183081)
@@ -66,6 +66,7 @@
static String mediaLoadingFailedKey();
WEBCORE_EXPORT static String missingValidatorFieldsKey();
static String navigationKey();
+ WEBCORE_EXPORT static String needsRevalidationKey();
WEBCORE_EXPORT static String networkCacheKey();
static String networkKey();
WEBCORE_EXPORT static String neverSeenBeforeKey();
@@ -101,7 +102,7 @@
static String resourceResponseKey();
WEBCORE_EXPORT static String retrievalKey();
WEBCORE_EXPORT static String retrievalRequestKey();
- static String revalidatingKey();
+ WEBCORE_EXPORT static String revalidatingKey();
static String sameLoadKey();
static String scriptKey();
static String sourceKey();
Modified: trunk/Source/WebKit2/ChangeLog (183080 => 183081)
--- trunk/Source/WebKit2/ChangeLog 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/ChangeLog 2015-04-21 23:20:32 UTC (rev 183081)
@@ -1,3 +1,28 @@
+2015-04-21 Chris Dumez <cdu...@apple.com>
+
+ [WK2][NetworkCache] Better account of resource revalidations in efficacy logging
+ https://bugs.webkit.org/show_bug.cgi?id=144014
+
+ Reviewed by Antti Koivisto.
+
+ Better account of resource revalidations in efficacy logging.
+ Prevously, resources that were in the cache but needed revalidation
+ were counted as retrieval successes, which is not entirely accurate.
+
+ We now distinguish "is in the cache and is directly usable" from
+ "is in the cache but needs revalidation". We also log how many of these
+ revalidations are successful.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
+ * NetworkProcess/cache/NetworkCache.cpp:
+ (WebKit::NetworkCache::Cache::update):
+ * NetworkProcess/cache/NetworkCache.h:
+ * NetworkProcess/cache/NetworkCacheStatistics.cpp:
+ (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
+ (WebKit::NetworkCache::Statistics::recordRevalidationSuccess):
+ * NetworkProcess/cache/NetworkCacheStatistics.h:
+
2015-04-21 Dan Bernstein <m...@apple.com>
[Cocoa] Framework header postprocessing should respect additional definitions
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (183080 => 183081)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2015-04-21 23:20:32 UTC (rev 183081)
@@ -246,7 +246,7 @@
if (m_cacheEntryForValidation) {
bool validationSucceeded = m_response.httpStatusCode() == 304; // 304 Not Modified
if (validationSucceeded)
- NetworkCache::singleton().update(originalRequest(), *m_cacheEntryForValidation, m_response);
+ NetworkCache::singleton().update(originalRequest(), m_parameters.webPageID, *m_cacheEntryForValidation, m_response);
else
m_cacheEntryForValidation = nullptr;
}
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (183080 => 183081)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-04-21 23:20:32 UTC (rev 183081)
@@ -385,7 +385,7 @@
});
}
-void Cache::update(const WebCore::ResourceRequest& originalRequest, const Entry& existingEntry, const WebCore::ResourceResponse& validatingResponse)
+void Cache::update(const WebCore::ResourceRequest& originalRequest, uint64_t webPageID, const Entry& existingEntry, const WebCore::ResourceResponse& validatingResponse)
{
LOG(NetworkCache, "(NetworkProcess) updating %s", originalRequest.url().string().latin1().data());
@@ -397,6 +397,9 @@
auto updateRecord = updateEntry.encodeAsStorageRecord();
m_storage->store(updateRecord, { });
+
+ if (m_statistics)
+ m_statistics->recordRevalidationSuccess(webPageID, existingEntry.key(), originalRequest);
}
void Cache::remove(const Key& key)
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h (183080 => 183081)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h 2015-04-21 23:20:32 UTC (rev 183081)
@@ -94,7 +94,7 @@
// Completion handler may get called back synchronously on failure.
void retrieve(const WebCore::ResourceRequest&, uint64_t webPageID, std::function<void (std::unique_ptr<Entry>)>);
void store(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, RefPtr<WebCore::SharedBuffer>&&, std::function<void (MappedBody&)>);
- void update(const WebCore::ResourceRequest&, const Entry&, const WebCore::ResourceResponse& validatingResponse);
+ void update(const WebCore::ResourceRequest&, uint64_t webPageID, const Entry&, const WebCore::ResourceResponse& validatingResponse);
void traverse(std::function<void (const Entry*)>&&);
void remove(const Key&);
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp (183080 => 183081)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.cpp 2015-04-21 23:20:32 UTC (rev 183081)
@@ -287,17 +287,31 @@
void Statistics::recordRetrievedCachedEntry(uint64_t webPageID, const Key& key, const WebCore::ResourceRequest& request, UseDecision decision)
{
WebCore::URL requestURL = request.url();
- if (decision == UseDecision::Use || decision == UseDecision::Validate) {
+ if (decision == UseDecision::Use) {
LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache and is used", webPageID, requestURL.string().ascii().data());
NetworkProcess::singleton().logDiagnosticMessageWithResult(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingResultPass, WebCore::ShouldSample::Yes);
return;
}
+ if (decision == UseDecision::Validate) {
+ LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache but needs revalidation", webPageID, requestURL.string().ascii().data());
+ NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::needsRevalidationKey(), WebCore::ShouldSample::Yes);
+ return;
+ }
+
String diagnosticKey = cachedEntryReuseFailureToDiagnosticKey(decision);
LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache but wasn't used, reason: %s", webPageID, requestURL.string().ascii().data(), diagnosticKey.utf8().data());
NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::unusableCachedEntryKey(), diagnosticKey, WebCore::ShouldSample::Yes);
}
+void Statistics::recordRevalidationSuccess(uint64_t webPageID, const Key& key, const WebCore::ResourceRequest& request)
+{
+ WebCore::URL requestURL = request.url();
+ LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s was successfully revalidated", webPageID, requestURL.string().ascii().data());
+
+ NetworkProcess::singleton().logDiagnosticMessageWithResult(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::revalidatingKey(), WebCore::DiagnosticLoggingResultPass, WebCore::ShouldSample::Yes);
+}
+
void Statistics::markAsRequested(const String& hash)
{
ASSERT(RunLoop::isMain());
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h (183080 => 183081)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h 2015-04-21 23:07:59 UTC (rev 183080)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h 2015-04-21 23:20:32 UTC (rev 183081)
@@ -52,6 +52,7 @@
void recordNotUsingCacheForRequest(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, RetrieveDecision);
void recordRetrievalFailure(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&);
void recordRetrievedCachedEntry(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&, UseDecision);
+ void recordRevalidationSuccess(uint64_t webPageID, const Key&, const WebCore::ResourceRequest&);
private:
explicit Statistics(const String& databasePath);