Changeset 229643 in webkit
- Timestamp:
- Mar 15, 2018 3:27:25 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r229639 r229643 1 2018-03-15 Keith Rollin <krollin@apple.com> 2 3 Telemetry for stalled webpage loads 4 https://bugs.webkit.org/show_bug.cgi?id=183221 5 <rdar://problem/36549013> 6 7 Reviewed by Chris Dumez. 8 9 Add telemetry for page loads, tracking the pages that succeed, fail, 10 or are canceled. This information will be used to track the overall 11 health of our page loading as time goes on. 12 13 No new tests -- no new/changed user-level functionality. 14 15 * page/DiagnosticLoggingKeys.cpp: 16 (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey): 17 (WebCore::DiagnosticLoggingKeys::timedOutKey): 18 (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey): 19 (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey): 20 (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey): 21 (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey): 22 (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey): 23 (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey): 24 (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey): 25 (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey): 26 (WebCore::DiagnosticLoggingKeys::occurredKey): 27 (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey): 28 (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey): 29 (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey): 30 (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey): 31 * page/DiagnosticLoggingKeys.h: 32 * platform/network/cf/ResourceError.h: 33 (WebCore::ResourceError::ResourceError): 34 * platform/network/mac/ResourceErrorMac.mm: 35 (WebCore::ResourceError::ResourceError): 36 (WebCore::ResourceError::getNSURLErrorDomain const): 37 (WebCore::ResourceError::getCFErrorDomainCFNetwork const): 38 (WebCore::ResourceError::mapPlatformError): 39 1 40 2018-03-15 Youenn Fablet <youenn@apple.com> 2 41 -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp
r226677 r229643 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 564 564 { 565 565 return ASCIILiteral("synchronousMessageFailed"); 566 } 567 568 String DiagnosticLoggingKeys::telemetryPageLoadKey() 569 { 570 return ASCIILiteral("telemetryPageLoad"); 571 } 572 573 String DiagnosticLoggingKeys::timedOutKey() 574 { 575 return ASCIILiteral("timedOut"); 576 } 577 578 String DiagnosticLoggingKeys::canceledLessThan2SecondsKey() 579 { 580 return ASCIILiteral("canceledLessThan2Seconds"); 581 } 582 583 String DiagnosticLoggingKeys::canceledLessThan5SecondsKey() 584 { 585 return ASCIILiteral("canceledLessThan5Seconds"); 586 } 587 588 String DiagnosticLoggingKeys::canceledLessThan20SecondsKey() 589 { 590 return ASCIILiteral("canceledLessThan20Seconds"); 591 } 592 593 String DiagnosticLoggingKeys::canceledMoreThan20SecondsKey() 594 { 595 return ASCIILiteral("canceledMoreThan20Seconds"); 596 } 597 598 String DiagnosticLoggingKeys::failedLessThan2SecondsKey() 599 { 600 return ASCIILiteral("failedLessThan2Seconds"); 601 } 602 603 String DiagnosticLoggingKeys::failedLessThan5SecondsKey() 604 { 605 return ASCIILiteral("failedLessThan5Seconds"); 606 } 607 608 String DiagnosticLoggingKeys::failedLessThan20SecondsKey() 609 { 610 return ASCIILiteral("failedLessThan20Seconds"); 611 } 612 613 String DiagnosticLoggingKeys::failedMoreThan20SecondsKey() 614 { 615 return ASCIILiteral("failedMoreThan20Seconds"); 616 } 617 618 String DiagnosticLoggingKeys::occurredKey() 619 { 620 return ASCIILiteral("occurred"); 621 } 622 623 String DiagnosticLoggingKeys::succeededLessThan2SecondsKey() 624 { 625 return ASCIILiteral("succeededLessThan2Seconds"); 626 } 627 628 String DiagnosticLoggingKeys::succeededLessThan5SecondsKey() 629 { 630 return ASCIILiteral("succeededLessThan5Seconds"); 631 } 632 633 String DiagnosticLoggingKeys::succeededLessThan20SecondsKey() 634 { 635 return ASCIILiteral("succeededLessThan20Seconds"); 636 } 637 638 String DiagnosticLoggingKeys::succeededMoreThan20SecondsKey() 639 { 640 return ASCIILiteral("succeededMoreThan20Seconds"); 566 641 } 567 642 -
trunk/Source/WebCore/page/DiagnosticLoggingKeys.h
r226677 r229643 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 44 44 static String cachedResourceRevalidationReasonKey(); 45 45 static String canCacheKey(); 46 WEBCORE_EXPORT static String canceledLessThan2SecondsKey(); 47 WEBCORE_EXPORT static String canceledLessThan5SecondsKey(); 48 WEBCORE_EXPORT static String canceledLessThan20SecondsKey(); 49 WEBCORE_EXPORT static String canceledMoreThan20SecondsKey(); 46 50 static String cannotSuspendActiveDOMObjectsKey(); 47 51 WEBCORE_EXPORT static String cpuUsageKey(); … … 65 69 WEBCORE_EXPORT static String entryWronglyNotWarmedUpKey(); 66 70 static String expiredKey(); 71 WEBCORE_EXPORT static String failedLessThan2SecondsKey(); 72 WEBCORE_EXPORT static String failedLessThan5SecondsKey(); 73 WEBCORE_EXPORT static String failedLessThan20SecondsKey(); 74 WEBCORE_EXPORT static String failedMoreThan20SecondsKey(); 67 75 static String fontKey(); 68 76 static String hasPluginsKey(); … … 106 114 WEBCORE_EXPORT static String notHTTPFamilyKey(); 107 115 static String notInMemoryCacheKey(); 116 WEBCORE_EXPORT static String occurredKey(); 108 117 WEBCORE_EXPORT static String otherKey(); 109 118 static String pageCacheKey(); … … 143 152 WEBCORE_EXPORT static String streamingMedia(); 144 153 static String styleSheetKey(); 154 WEBCORE_EXPORT static String succeededLessThan2SecondsKey(); 155 WEBCORE_EXPORT static String succeededLessThan5SecondsKey(); 156 WEBCORE_EXPORT static String succeededLessThan20SecondsKey(); 157 WEBCORE_EXPORT static String succeededMoreThan20SecondsKey(); 145 158 WEBCORE_EXPORT static String successfulSpeculativeWarmupWithRevalidationKey(); 146 159 WEBCORE_EXPORT static String successfulSpeculativeWarmupWithoutRevalidationKey(); 147 160 static String svgDocumentKey(); 148 161 WEBCORE_EXPORT static String synchronousMessageFailedKey(); 162 WEBCORE_EXPORT static String telemetryPageLoadKey(); 163 WEBCORE_EXPORT static String timedOutKey(); 149 164 WEBCORE_EXPORT static String uncacheableStatusCodeKey(); 150 165 static String underMemoryPressureKey(); -
trunk/Source/WebCore/platform/network/cf/ResourceError.h
r227207 r229643 55 55 , m_dataIsUpToDate(true) 56 56 { 57 #if PLATFORM(COCOA) 58 ASSERT(domain != getNSURLErrorDomain()); 59 ASSERT(domain != getCFErrorDomainCFNetwork()); 60 #endif 57 61 } 58 62 … … 82 86 friend class ResourceErrorBase; 83 87 88 #if PLATFORM(COCOA) 89 WEBCORE_EXPORT const String& getNSURLErrorDomain() const; 90 WEBCORE_EXPORT const String& getCFErrorDomainCFNetwork() const; 91 WEBCORE_EXPORT void mapPlatformError(); 92 #endif 84 93 void platformLazyInit(); 85 94 -
trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm
r224846 r229643 31 31 #import <Foundation/Foundation.h> 32 32 #import <wtf/BlockObjCExceptions.h> 33 #import <wtf/NeverDestroyed.h> 34 #import <wtf/text/WTFString.h> 33 35 34 36 @interface NSError (WebExtras) … … 113 115 , m_platformError(nsError) 114 116 { 115 if (nsError) 116 setType(([m_platformError.get() code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General); 117 mapPlatformError(); 117 118 } 118 119 … … 120 121 : ResourceError((NSError *)cfError) 121 122 { 123 } 124 125 const String& ResourceError::getNSURLErrorDomain() const 126 { 127 static const NeverDestroyed<String> errorDomain(NSURLErrorDomain); 128 return errorDomain.get(); 129 } 130 131 const String& ResourceError::getCFErrorDomainCFNetwork() const 132 { 133 static const NeverDestroyed<String> errorDomain(kCFErrorDomainCFNetwork); 134 return errorDomain.get(); 135 } 136 137 void ResourceError::mapPlatformError() 138 { 139 static_assert(NSURLErrorTimedOut == kCFURLErrorTimedOut, "NSURLErrorTimedOut needs to equal kCFURLErrorTimedOut"); 140 static_assert(NSURLErrorCancelled == kCFURLErrorCancelled, "NSURLErrorCancelled needs to equal kCFURLErrorCancelled"); 141 142 if (!m_platformError) 143 return; 144 145 auto domain = [m_platformError.get() domain]; 146 auto errorCode = [m_platformError.get() code]; 147 148 if ([domain isEqualToString:NSURLErrorDomain] || [domain isEqualToString:(__bridge NSString *)kCFErrorDomainCFNetwork]) 149 setType((errorCode == NSURLErrorTimedOut) ? Type::Timeout : (errorCode == NSURLErrorCancelled) ? Type::Cancellation : Type::General); 150 else 151 setType(Type::General); 122 152 } 123 153 -
trunk/Source/WebKit/ChangeLog
r229641 r229643 1 2018-03-15 Keith Rollin <krollin@apple.com> 2 3 Telemetry for stalled webpage loads 4 https://bugs.webkit.org/show_bug.cgi?id=183221 5 <rdar://problem/36549013> 6 7 Reviewed by Chris Dumez. 8 9 Add telemetry for page loads, tracking the pages that succeed, fail, 10 or are canceled. This information will be used to track the overall 11 health of our page loading as time goes on. 12 13 * UIProcess/WebPageProxy.cpp: 14 (WebKit::WebPageProxy::close): 15 (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): 16 (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): 17 (WebKit::WebPageProxy::didFinishLoadForFrame): 18 (WebKit::WebPageProxy::didFailLoadForFrame): 19 (WebKit::WebPageProxy::reportPageLoadResult): 20 * UIProcess/WebPageProxy.h: 21 (WebKit::WebPageProxy::reportPageLoadResult): 22 1 23 2018-03-15 Wenson Hsieh <wenson_hsieh@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r229617 r229643 777 777 m_isClosed = true; 778 778 779 if (m_pageLoadStart) 780 reportPageLoadResult(ResourceError { ResourceError::Type::Cancellation }); 781 779 782 if (m_activePopupMenu) 780 783 m_activePopupMenu->cancelTracking(); … … 3258 3261 3259 3262 if (frame->isMainFrame()) { 3263 if (m_pageLoadStart) 3264 reportPageLoadResult(ResourceError { ResourceError::Type::Cancellation }); 3265 m_pageLoadStart = MonotonicTime::now(); 3260 3266 m_pageLoadState.didStartProvisionalLoad(transaction, url, unreachableURL); 3261 3267 m_pageClient.didStartProvisionalLoadForMainFrame(); … … 3369 3375 3370 3376 if (frame->isMainFrame()) { 3377 reportPageLoadResult(error); 3371 3378 m_pageLoadState.didFailProvisionalLoad(transaction); 3372 3379 m_pageClient.didFailProvisionalLoadForMainFrame(); … … 3538 3545 m_loaderClient->didFinishLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get()); 3539 3546 3540 if (isMainFrame) 3547 if (isMainFrame) { 3548 reportPageLoadResult(); 3541 3549 m_pageClient.didFinishLoadForMainFrame(); 3550 } 3542 3551 3543 3552 m_isLoadingAlternateHTMLStringForFailingProvisionalLoad = false; … … 3579 3588 m_loaderClient->didFailLoadWithErrorForFrame(*this, *frame, navigation.get(), error, m_process->transformHandlesToObjects(userData.object()).get()); 3580 3589 3581 if (isMainFrame) 3590 if (isMainFrame) { 3591 reportPageLoadResult(error); 3582 3592 m_pageClient.didFailLoadForMainFrame(); 3593 } 3583 3594 } 3584 3595 … … 7374 7385 #endif 7375 7386 7387 namespace { 7388 enum class CompletionCondition { 7389 Cancellation, 7390 Error, 7391 Success, 7392 Timeout, 7393 }; 7394 struct MessageType { 7395 CompletionCondition condition; 7396 Seconds seconds; 7397 String message; 7398 }; 7399 } 7400 7401 void WebPageProxy::reportPageLoadResult(const ResourceError& error) 7402 { 7403 static const NeverDestroyed<Vector<MessageType>> messages(std::initializer_list<MessageType> { 7404 { CompletionCondition::Cancellation, 2_s, DiagnosticLoggingKeys::canceledLessThan2SecondsKey() }, 7405 { CompletionCondition::Cancellation, 5_s, DiagnosticLoggingKeys::canceledLessThan5SecondsKey() }, 7406 { CompletionCondition::Cancellation, 20_s, DiagnosticLoggingKeys::canceledLessThan20SecondsKey() }, 7407 { CompletionCondition::Cancellation, Seconds::infinity(), DiagnosticLoggingKeys::canceledMoreThan20SecondsKey() }, 7408 7409 { CompletionCondition::Error, 2_s, DiagnosticLoggingKeys::failedLessThan2SecondsKey() }, 7410 { CompletionCondition::Error, 5_s, DiagnosticLoggingKeys::failedLessThan5SecondsKey() }, 7411 { CompletionCondition::Error, 20_s, DiagnosticLoggingKeys::failedLessThan20SecondsKey() }, 7412 { CompletionCondition::Error, Seconds::infinity(), DiagnosticLoggingKeys::failedMoreThan20SecondsKey() }, 7413 7414 { CompletionCondition::Success, 2_s, DiagnosticLoggingKeys::succeededLessThan2SecondsKey() }, 7415 { CompletionCondition::Success, 5_s, DiagnosticLoggingKeys::succeededLessThan5SecondsKey() }, 7416 { CompletionCondition::Success, 20_s, DiagnosticLoggingKeys::succeededLessThan20SecondsKey() }, 7417 { CompletionCondition::Success, Seconds::infinity(), DiagnosticLoggingKeys::succeededMoreThan20SecondsKey() }, 7418 7419 { CompletionCondition::Timeout, Seconds::infinity(), DiagnosticLoggingKeys::timedOutKey() } 7420 }); 7421 7422 ASSERT(m_pageLoadStart); 7423 7424 auto pageLoadTime = MonotonicTime::now() - *m_pageLoadStart; 7425 m_pageLoadStart = std::nullopt; 7426 7427 CompletionCondition condition { CompletionCondition::Success }; 7428 if (error.isCancellation()) 7429 condition = CompletionCondition::Cancellation; 7430 else if (error.isTimeout()) 7431 condition = CompletionCondition::Timeout; 7432 else if (!error.isNull() || error.errorCode()) 7433 condition = CompletionCondition::Error; 7434 7435 for (auto& messageItem : messages.get()) { 7436 if (condition == messageItem.condition && pageLoadTime < messageItem.seconds) { 7437 logDiagnosticMessage(DiagnosticLoggingKeys::telemetryPageLoadKey(), messageItem.message, ShouldSample::No); 7438 logDiagnosticMessage(DiagnosticLoggingKeys::telemetryPageLoadKey(), DiagnosticLoggingKeys::occurredKey(), ShouldSample::No); 7439 break; 7440 } 7441 } 7442 } 7443 7376 7444 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r229617 r229643 1 1 /* 2 * Copyright (C) 2010-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 88 88 #include <wtf/HashSet.h> 89 89 #include <wtf/MonotonicTime.h> 90 #include <wtf/Optional.h> 90 91 #include <wtf/ProcessID.h> 91 92 #include <wtf/Ref.h> … … 1721 1722 #endif 1722 1723 1724 void reportPageLoadResult(const WebCore::ResourceError& = { }); 1725 1723 1726 PageClient& m_pageClient; 1724 1727 Ref<API::PageConfiguration> m_configuration; … … 2119 2122 HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme; 2120 2123 HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier; 2124 2125 std::optional<MonotonicTime> m_pageLoadStart; 2121 2126 }; 2122 2127
Note: See TracChangeset
for help on using the changeset viewer.