Changeset 179972 in webkit
- Timestamp:
- Feb 11, 2015 3:57:31 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r179971 r179972 1 2015-02-11 Chris Dumez <cdumez@apple.com> 2 3 [WK2] Add logging to validate the network cache efficacy (Part 2) 4 https://bugs.webkit.org/show_bug.cgi?id=141345 5 <rdar://problem/19632080> 6 7 Reviewed by Sam Weinig. 8 9 Add a few more diagnostic logging keys for the network cache efficacy 10 logging. 11 1 12 2015-02-11 Sam Weinig <sam@webkit.org> 2 13 -
trunk/Source/WebCore/WebCore.exp.in
r179919 r179972 946 946 __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_19IDBDatabaseMetadataEE4copyERKS1_ 947 947 __ZN7WebCore21DiagnosticLoggingKeys10webViewKeyEv 948 __ZN7WebCore21DiagnosticLoggingKeys12retrievalKeyEv 949 __ZN7WebCore21DiagnosticLoggingKeys15networkCacheKeyEv 950 __ZN7WebCore21DiagnosticLoggingKeys25noLongerInCacheFailureKeyEv 951 __ZN7WebCore21DiagnosticLoggingKeys26unhandledRequestFailureKeyEv 952 __ZN7WebCore21DiagnosticLoggingKeys29unusableCachedEntryFailureKeyEv 948 953 __ZN7WebCore21DiagnosticLoggingKeys7userKeyEv 949 954 __ZN7WebCore21DiagnosticLoggingKeys9zoomedKeyEv -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp
r179919 r179972 104 104 } 105 105 106 String DiagnosticLoggingKeys::networkCacheKey() 107 { 108 return ASCIILiteral("networkCache"); 109 } 110 106 111 String DiagnosticLoggingKeys::networkKey() 107 112 { … … 134 139 } 135 140 141 String DiagnosticLoggingKeys::noLongerInCacheFailureKey() 142 { 143 return ASCIILiteral("noLongerInCacheFailure"); 144 } 145 136 146 String DiagnosticLoggingKeys::otherKey() 137 147 { … … 299 309 } 300 310 311 String DiagnosticLoggingKeys::retrievalKey() 312 { 313 return ASCIILiteral("retrieval"); 314 } 315 301 316 String DiagnosticLoggingKeys::revalidatingKey() 302 317 { … … 334 349 } 335 350 351 String DiagnosticLoggingKeys::unhandledRequestFailureKey() 352 { 353 return ASCIILiteral("unhandledRequestFailure"); 354 } 355 356 String DiagnosticLoggingKeys::unusableCachedEntryFailureKey() 357 { 358 return ASCIILiteral("unusableCachedEntryFailure"); 359 } 360 336 361 String DiagnosticLoggingKeys::unusedKey() 337 362 { -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.h
r179919 r179972 64 64 static String mustRevalidateIsExpiredKey(); 65 65 static String navigationKey(); 66 WEBCORE_EXPORT static String networkCacheKey(); 66 67 static String networkKey(); 67 68 static String noCacheKey(); 68 69 static String noCurrentHistoryItemKey(); 69 70 static String noDocumentLoaderKey(); 71 WEBCORE_EXPORT static String noLongerInCacheFailureKey(); 70 72 static String noStoreKey(); 71 73 static String notInMemoryCacheKey(); … … 91 93 static String resourceRequestKey(); 92 94 static String resourceResponseKey(); 95 WEBCORE_EXPORT static String retrievalKey(); 93 96 static String revalidatingKey(); 94 97 static String sameLoadKey(); … … 97 100 static String styleSheetKey(); 98 101 static String svgDocumentKey(); 102 WEBCORE_EXPORT static String unhandledRequestFailureKey(); 103 WEBCORE_EXPORT static String unusableCachedEntryFailureKey(); 99 104 static String unusedKey(); 100 105 static String unusedReasonCredentialSettingsKey(); -
trunk/Source/WebKit2/ChangeLog
r179955 r179972 1 2015-02-11 Chris Dumez <cdumez@apple.com> 2 3 [WK2] Add logging to validate the network cache efficacy (Part 2) 4 https://bugs.webkit.org/show_bug.cgi?id=141345 5 <rdar://problem/19632080> 6 7 Reviewed by Sam Weinig. 8 9 Add diagnostic logging messages to validate the network cache efficacy. 10 The following 4 messages are added: 11 - networkCache / retrieval / success 12 - networkCache / retrieval / unhandledRequestFailure 13 - networkCache / retrieval / noLongerInCacheFailure 14 - networkCache / retrieval / unusableCachedEntryFailure 15 16 The messages are sent via IPC from the NetworkProcess to the UIProcess, 17 where the WebPageProxy code already handles diagnostic messages sent by 18 the WebProcess. 19 1 20 2015-02-11 Tim Horton <timothy_horton@apple.com> 2 21 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r179919 r179972 302 302 } 303 303 304 void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String& message, const String& description) 305 { 306 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessage(webPageID, message, description), 0); 307 } 308 309 void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String& message, const String& description, WebCore::DiagnosticLoggingResultType result) 310 { 311 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithResult(webPageID, message, description, result), 0); 312 } 313 314 void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String& message, const String& description, const String& value) 315 { 316 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithValue(webPageID, message, description, value), 0); 317 } 318 304 319 void NetworkProcess::terminate() 305 320 { -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h
r179919 r179972 34 34 #include "MessageReceiverMap.h" 35 35 #include "NetworkResourceLoadScheduler.h" 36 #include <WebCore/DiagnosticLoggingResultType.h> 36 37 #include <WebCore/SessionID.h> 37 38 #include <memory> … … 75 76 DownloadManager& downloadManager(); 76 77 bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; } 78 79 // Diagnostic messages logging. 80 void logDiagnosticMessage(uint64_t webPageID, const String& message, const String& description); 81 void logDiagnosticMessageWithResult(uint64_t webPageID, const String& message, const String& description, WebCore::DiagnosticLoggingResultType); 82 void logDiagnosticMessageWithValue(uint64_t webPageID, const String& message, const String& description, const String& value); 77 83 78 84 private: -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
r179919 r179972 142 142 143 143 RefPtr<NetworkResourceLoader> loader(this); 144 NetworkCache::singleton().retrieve(originalRequest(), [loader](std::unique_ptr<NetworkCache::Entry> entry) {144 NetworkCache::singleton().retrieve(originalRequest(), m_parameters.webPageID, [loader](std::unique_ptr<NetworkCache::Entry> entry) { 145 145 if (loader->hasOneRef()) { 146 146 // The loader has been aborted and is only held alive by this lambda. -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
r179919 r179972 219 219 } 220 220 221 void NetworkCache::retrieve(const WebCore::ResourceRequest& originalRequest, std::function<void (std::unique_ptr<Entry>)> completionHandler)221 void NetworkCache::retrieve(const WebCore::ResourceRequest& originalRequest, uint64_t webPageID, std::function<void (std::unique_ptr<Entry>)> completionHandler) 222 222 { 223 223 ASSERT(isEnabled()); … … 228 228 if (!canRetrieve(originalRequest)) { 229 229 if (m_statistics) 230 m_statistics->recordNotUsingCacheForRequest( storageKey, originalRequest);230 m_statistics->recordNotUsingCacheForRequest(webPageID, storageKey, originalRequest); 231 231 232 232 completionHandler(nullptr); … … 237 237 unsigned priority = originalRequest.priority(); 238 238 239 m_storage->retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey ](std::unique_ptr<NetworkCacheStorage::Entry> entry) {239 m_storage->retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey, webPageID](std::unique_ptr<NetworkCacheStorage::Entry> entry) { 240 240 if (!entry) { 241 241 LOG(NetworkCache, "(NetworkProcess) not found in storage"); 242 242 243 243 if (m_statistics) 244 m_statistics->recordRetrievalFailure( storageKey, originalRequest);244 m_statistics->recordRetrievalFailure(webPageID, storageKey, originalRequest); 245 245 246 246 completionHandler(nullptr); … … 250 250 bool success = !!decodedEntry; 251 251 if (m_statistics) 252 m_statistics->recordRetrievedCachedEntry( storageKey, originalRequest, success);252 m_statistics->recordRetrievedCachedEntry(webPageID, storageKey, originalRequest, success); 253 253 254 254 #if !LOG_DISABLED -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h
r179919 r179972 65 65 }; 66 66 // Completion handler may get called back synchronously on failure. 67 void retrieve(const WebCore::ResourceRequest&, std::function<void (std::unique_ptr<Entry>)>);67 void retrieve(const WebCore::ResourceRequest&, uint64_t webPageID, std::function<void (std::unique_ptr<Entry>)>); 68 68 69 69 struct MappedBody { -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h
r179919 r179972 45 45 void clear(); 46 46 47 void recordNotUsingCacheForRequest( const NetworkCacheKey&, const WebCore::ResourceRequest&);48 void recordRetrievalFailure( const NetworkCacheKey&, const WebCore::ResourceRequest&);49 void recordRetrievedCachedEntry( const NetworkCacheKey&, const WebCore::ResourceRequest&, bool success);47 void recordNotUsingCacheForRequest(uint64_t webPageID, const NetworkCacheKey&, const WebCore::ResourceRequest&); 48 void recordRetrievalFailure(uint64_t webPageID, const NetworkCacheKey&, const WebCore::ResourceRequest&); 49 void recordRetrievedCachedEntry(uint64_t webPageID, const NetworkCacheKey&, const WebCore::ResourceRequest&, bool success); 50 50 51 51 private: -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm
r179919 r179972 32 32 #include "NetworkCache.h" 33 33 #include "NetworkCacheFileSystemPosix.h" 34 #include "NetworkProcess.h" 35 #include <WebCore/DiagnosticLoggingKeys.h> 36 #include <WebCore/DiagnosticLoggingResultType.h> 34 37 #include <WebCore/ResourceRequest.h> 35 38 #include <WebCore/SQLiteDatabaseTracker.h> … … 166 169 } 167 170 168 void NetworkCacheStatistics::recordNotUsingCacheForRequest( const NetworkCacheKey& key, const WebCore::ResourceRequest& request)171 void NetworkCacheStatistics::recordNotUsingCacheForRequest(uint64_t webPageID, const NetworkCacheKey& key, const WebCore::ResourceRequest& request) 169 172 { 170 173 String hash = key.hashAsString(); 171 174 WebCore::URL requestURL = request.url(); 172 queryWasEverRequested(hash, [this, hash, requestURL ](bool wasEverRequested) {175 queryWasEverRequested(hash, [this, hash, requestURL, webPageID](bool wasEverRequested) { 173 176 if (wasEverRequested) { 174 LOG(NetworkCache, "(NetworkProcess) %s was previously requested but is not handled by the cache", requestURL.string().ascii().data());175 // FIXME: Do diagnostic logging.177 LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s was previously requested but is not handled by the cache", webPageID, requestURL.string().ascii().data()); 178 NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::unhandledRequestFailureKey()); 176 179 } else 177 180 markAsRequested(hash); … … 179 182 } 180 183 181 void NetworkCacheStatistics::recordRetrievalFailure( const NetworkCacheKey& key, const WebCore::ResourceRequest& request)184 void NetworkCacheStatistics::recordRetrievalFailure(uint64_t webPageID, const NetworkCacheKey& key, const WebCore::ResourceRequest& request) 182 185 { 183 186 String hash = key.hashAsString(); 184 187 WebCore::URL requestURL = request.url(); 185 queryWasEverRequested(hash, [this, hash, requestURL ](bool wasPreviouslyRequested) {188 queryWasEverRequested(hash, [this, hash, requestURL, webPageID](bool wasPreviouslyRequested) { 186 189 if (wasPreviouslyRequested) { 187 LOG(NetworkCache, "(NetworkProcess) %s was previously cached but is no longer in the cache", requestURL.string().ascii().data());188 // FIXME: Do diagnostic logging.190 LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s was previously cached but is no longer in the cache", webPageID, requestURL.string().ascii().data()); 191 NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::noLongerInCacheFailureKey()); 189 192 } else 190 193 markAsRequested(hash); … … 192 195 } 193 196 194 void NetworkCacheStatistics::recordRetrievedCachedEntry( const NetworkCacheKey& key, const WebCore::ResourceRequest& request, bool success)197 void NetworkCacheStatistics::recordRetrievedCachedEntry(uint64_t webPageID, const NetworkCacheKey& key, const WebCore::ResourceRequest& request, bool success) 195 198 { 196 199 WebCore::URL requestURL = request.url(); 197 if (success) 198 LOG(NetworkCache, "(NetworkProcess) %s is in the cache and is used", requestURL.string().ascii().data()); 199 else 200 LOG(NetworkCache, "(NetworkProcess) %s is in the cache but wasn't used", requestURL.string().ascii().data()); 201 // FIXME: Do diagnostic logging. 200 if (success) { 201 LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache and is used", webPageID, requestURL.string().ascii().data()); 202 NetworkProcess::singleton().logDiagnosticMessageWithResult(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingResultPass); 203 } else { 204 LOG(NetworkCache, "(NetworkProcess) webPageID %llu: %s is in the cache but wasn't used", webPageID, requestURL.string().ascii().data()); 205 NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::unusableCachedEntryFailureKey()); 206 } 202 207 } 203 208 -
trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
r179919 r179972 231 231 } 232 232 233 void NetworkProcessProxy::logDiagnosticMessage(uint64_t pageID, const String& message, const String& description) 234 { 235 WebPageProxy* page = WebProcessProxy::webPage(pageID); 236 // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this, 237 // but for now we simply drop the message in the rare case this happens. 238 if (!page) 239 return; 240 241 page->logDiagnosticMessage(message, description); 242 } 243 244 void NetworkProcessProxy::logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result) 245 { 246 WebPageProxy* page = WebProcessProxy::webPage(pageID); 247 // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this, 248 // but for now we simply drop the message in the rare case this happens. 249 if (!page) 250 return; 251 252 page->logDiagnosticMessageWithResult(message, description, result); 253 } 254 255 void NetworkProcessProxy::logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, const String& value) 256 { 257 WebPageProxy* page = WebProcessProxy::webPage(pageID); 258 // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this, 259 // but for now we simply drop the message in the rare case this happens. 260 if (!page) 261 return; 262 263 page->logDiagnosticMessageWithValue(message, description, value); 264 } 265 233 266 } // namespace WebKit 234 267 -
trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h
r179919 r179972 92 92 void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID); 93 93 void didDeleteWebsiteData(uint64_t callbackID); 94 void logDiagnosticMessage(uint64_t pageID, const String& message, const String& description); 95 void logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result); 96 void logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, const String& value); 94 97 95 98 // ProcessLauncher::Client -
trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in
r179919 r179972 29 29 30 30 DidDeleteWebsiteData(uint64_t callbackID) 31 32 # Diagnostic messages logging 33 LogDiagnosticMessage(uint64_t pageID, String message, String description) 34 LogDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result) 35 LogDiagnosticMessageWithValue(uint64_t pageID, String message, String description, String value) 31 36 } 32 37 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r179919 r179972 989 989 void setShouldDispatchFakeMouseMoveEvents(bool); 990 990 991 // Diagnostic messages logging. 992 void logDiagnosticMessage(const String& message, const String& description); 993 void logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result); 994 void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value); 995 991 996 private: 992 997 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&); … … 1238 1243 void setCursorHiddenUntilMouseMoves(bool); 1239 1244 1240 // Diagnostic messages logging.1241 void logDiagnosticMessage(const String& message, const String& description);1242 void logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result);1243 void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value);1244 1245 1245 void didReceiveEvent(uint32_t opaqueType, bool handled); 1246 1246 void stopResponsivenessTimer();
Note: See TracChangeset
for help on using the changeset viewer.