Add system trace points for process launch and for initializeWebProcess
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2018 15:57:32 +0000 (15:57 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Apr 2018 15:57:32 +0000 (15:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184669

Reviewed by Simon Fraser.

Source/JavaScriptCore:

* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):

Source/WebCore:

No testing needed because there is no new functionality here.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::provisionalLoadStarted):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::didCancel):

Source/WebKit:

* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::ProcessLauncher):
(WebKit::ProcessLauncher::didFinishLaunchingProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Source/WTF:

This patch adds TracePointCodes to measure process launch time and
WebProcess::initializeWebProcess time.

It also renames the TracePoint function to tracePoint since WebKit style
does not capitalize the first letter in function names.

* wtf/SystemTracing.h:
(WTF::tracePoint):
(WTF::TraceScope::TraceScope):
(WTF::TraceScope::~TraceScope):
(WTF::TracePoint): Deleted.

Tools:

* Tracing/SystemTracePoints.plist:

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

12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/VMEntryScope.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/SystemTracing.h
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Launcher/ProcessLauncher.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Tools/ChangeLog
Tools/Tracing/SystemTracePoints.plist

index 8908633..2d5d89b 100644 (file)
@@ -1,3 +1,14 @@
+2018-04-17  Saam Barati  <sbarati@apple.com>
+
+        Add system trace points for process launch and for initializeWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=184669
+
+        Reviewed by Simon Fraser.
+
+        * runtime/VMEntryScope.cpp:
+        (JSC::VMEntryScope::VMEntryScope):
+        (JSC::VMEntryScope::~VMEntryScope):
+
 2018-04-17  Jer Noble  <jer.noble@apple.com>
 
         Fix duplicate symbol errors when building JavaScriptCore with non-empty WK_ALTERNATE_WEBKIT_SDK_PATH
index 07aed79..ba15199 100644 (file)
@@ -58,7 +58,7 @@ VMEntryScope::VMEntryScope(VM& vm, JSGlobalObject* globalObject)
         if (SamplingProfiler* samplingProfiler = vm.samplingProfiler())
             samplingProfiler->noticeVMEntry();
 #endif
-        TracePoint(VMEntryScopeStart);
+        tracePoint(VMEntryScopeStart);
     }
 
     vm.clearLastException();
@@ -77,7 +77,7 @@ VMEntryScope::~VMEntryScope()
     if (m_vm.entryScope != this)
         return;
 
-    TracePoint(VMEntryScopeEnd);
+    tracePoint(VMEntryScopeEnd);
     
     if (m_vm.watchdog())
         m_vm.watchdog()->exitedVM();
index 520e4e9..6cfc459 100644 (file)
@@ -1,3 +1,22 @@
+2018-04-17  Saam Barati  <sbarati@apple.com>
+
+        Add system trace points for process launch and for initializeWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=184669
+
+        Reviewed by Simon Fraser.
+
+        This patch adds TracePointCodes to measure process launch time and
+        WebProcess::initializeWebProcess time.
+        
+        It also renames the TracePoint function to tracePoint since WebKit style
+        does not capitalize the first letter in function names.
+
+        * wtf/SystemTracing.h:
+        (WTF::tracePoint):
+        (WTF::TraceScope::TraceScope):
+        (WTF::TraceScope::~TraceScope):
+        (WTF::TracePoint): Deleted.
+
 2018-04-16  Andy Estes  <aestes@apple.com>
 
         [iOS] Enable WKPDFView by default
index a0b5e59..b52be8d 100644 (file)
@@ -88,17 +88,21 @@ enum TracePointCode {
     SyncMessageEnd,
     SyncTouchEventStart,
     SyncTouchEventEnd,
+    InitializeWebProcessStart,
+    InitializeWebProcessEnd,
 
     UIProcessRange = 14000,
     CommitLayerTreeStart,
     CommitLayerTreeEnd,
+    ProcessLaunchStart,
+    ProcessLaunchEnd,
 };
 
 #ifdef __cplusplus
 
 namespace WTF {
 
-inline void TracePoint(TracePointCode code, uint64_t data1 = 0, uint64_t data2 = 0, uint64_t data3 = 0, uint64_t data4 = 0)
+inline void tracePoint(TracePointCode code, uint64_t data1 = 0, uint64_t data2 = 0, uint64_t data3 = 0, uint64_t data4 = 0)
 {
 #if HAVE(KDEBUG_H)
     kdebug_trace(ARIADNEDBG_CODE(WEBKIT_COMPONENT, code), data1, data2, data3, data4);
@@ -117,12 +121,12 @@ public:
     TraceScope(TracePointCode entryCode, TracePointCode exitCode, uint64_t data1 = 0, uint64_t data2 = 0, uint64_t data3 = 0, uint64_t data4 = 0)
         : m_exitCode(exitCode)
     {
-        TracePoint(entryCode, data1, data2, data3, data4);
+        tracePoint(entryCode, data1, data2, data3, data4);
     }
 
     ~TraceScope()
     {
-        TracePoint(m_exitCode);
+        tracePoint(m_exitCode);
     }
 
 private:
@@ -132,6 +136,6 @@ private:
 } // namespace WTF
 
 using WTF::TraceScope;
-using WTF::TracePoint;
+using WTF::tracePoint;
 
 #endif // __cplusplus
index d79e202..4dddd0e 100644 (file)
@@ -1,3 +1,21 @@
+2018-04-17  Saam Barati  <sbarati@apple.com>
+
+        Add system trace points for process launch and for initializeWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=184669
+
+        Reviewed by Simon Fraser.
+
+        No testing needed because there is no new functionality here.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::provisionalLoadStarted):
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequestInternal):
+        (WebCore::SubresourceLoader::didFinishLoading):
+        (WebCore::SubresourceLoader::didFail):
+        (WebCore::SubresourceLoader::didCancel):
+
 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] AirPlay device name is sometimes wrong
index 9fb15b3..759a4ce 100644 (file)
@@ -1031,7 +1031,7 @@ void FrameLoader::provisionalLoadStarted()
     m_client.provisionalLoadStarted();
 
     if (m_frame.isMainFrame()) {
-        TracePoint(MainResourceLoadDidStartProvisional);
+        tracePoint(MainResourceLoadDidStartProvisional);
 
         if (auto* page = m_frame.page())
             page->didStartProvisionalLoad();
@@ -2400,7 +2400,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
             Page* page = m_frame.page();
             if (page) {
                 if (m_frame.isMainFrame()) {
-                    TracePoint(MainResourceLoadDidEnd);
+                    tracePoint(MainResourceLoadDidEnd);
                     page->didFinishLoad();
                 }
             }
index 36d65b3..f7d24f2 100644 (file)
@@ -182,7 +182,7 @@ void SubresourceLoader::willSendRequestInternal(ResourceRequest&& newRequest, co
     }
 
     if (newRequest.requester() != ResourceRequestBase::Requester::Main) {
-        TracePoint(SubresourceLoadWillStart);
+        tracePoint(SubresourceLoadWillStart);
         ResourceLoadObserver::shared().logSubresourceLoading(m_frame.get(), newRequest, redirectResponse);
     }
 
@@ -630,7 +630,7 @@ void SubresourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMe
     }
 
     if (m_resource->type() != CachedResource::MainResource)
-        TracePoint(SubresourceLoadDidEnd);
+        tracePoint(SubresourceLoadDidEnd);
 
     m_state = Finishing;
     m_resource->finishLoading(resourceData());
@@ -665,7 +665,7 @@ void SubresourceLoader::didFail(const ResourceError& error)
     m_state = Finishing;
 
     if (m_resource->type() != CachedResource::MainResource)
-        TracePoint(SubresourceLoadDidEnd);
+        tracePoint(SubresourceLoadDidEnd);
 
     if (m_resource->resourceToRevalidate())
         MemoryCache::singleton().revalidationFailed(*m_resource);
@@ -713,7 +713,7 @@ void SubresourceLoader::didCancel(const ResourceError&)
         return;
 
     if (m_resource->type() != CachedResource::MainResource)
-        TracePoint(SubresourceLoadDidEnd);
+        tracePoint(SubresourceLoadDidEnd);
 
     m_resource->cancelLoad();
     notifyDone();
index 639a1c0..65bf178 100644 (file)
@@ -1,3 +1,16 @@
+2018-04-17  Saam Barati  <sbarati@apple.com>
+
+        Add system trace points for process launch and for initializeWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=184669
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/Launcher/ProcessLauncher.cpp:
+        (WebKit::ProcessLauncher::ProcessLauncher):
+        (WebKit::ProcessLauncher::didFinishLaunchingProcess):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
 2018-04-16  Timothy Hatcher  <timothy@apple.com>
 
         Unreviewed 32-bit build fix for r230673.
index 0ffa92d..f864ca9 100644 (file)
@@ -27,6 +27,7 @@
 #include "ProcessLauncher.h"
 
 #include <wtf/StdLibExtras.h>
+#include <wtf/SystemTracing.h>
 #include <wtf/WorkQueue.h>
 
 namespace WebKit {
@@ -37,11 +38,13 @@ ProcessLauncher::ProcessLauncher(Client* client, const LaunchOptions& launchOpti
     , m_processIdentifier(0)
 {
     m_isLaunching = true;
+    tracePoint(ProcessLaunchStart);
     launchProcess();
 }
 
 void ProcessLauncher::didFinishLaunchingProcess(ProcessID processIdentifier, IPC::Connection::Identifier identifier)
 {
+    tracePoint(ProcessLaunchEnd);
     m_processIdentifier = processIdentifier;
     m_isLaunching = false;
     
index 87ab736..239705d 100644 (file)
 #include <wtf/Language.h>
 #include <wtf/ProcessPrivilege.h>
 #include <wtf/RunLoop.h>
+#include <wtf/SystemTracing.h>
 #include <wtf/text/StringHash.h>
 
 #if !OS(WINDOWS)
@@ -279,6 +280,8 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
 
 void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
 {    
+    TraceScope traceScope(InitializeWebProcessStart, InitializeWebProcessEnd);
+
     ASSERT(m_pageMap.isEmpty());
 
     WebCore::setPresentingApplicationPID(parameters.presentingApplicationPID);
index dda414c..bf0de37 100644 (file)
@@ -1,3 +1,12 @@
+2018-04-17  Saam Barati  <sbarati@apple.com>
+
+        Add system trace points for process launch and for initializeWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=184669
+
+        Reviewed by Simon Fraser.
+
+        * Tracing/SystemTracePoints.plist:
+
 2018-04-17  Ross Kirsling  <ross.kirsling@sony.com>
 
         Add debug bots for WinCairo.
index 73efad7..e9e1776 100644 (file)
              </dict>
              <dict>
                  <key>Name</key>
+                 <string>Initialize Web Process</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>12009</string>
+                 <key>CodeEnd</key>
+                 <string>12010</string>
+             </dict>
+             <dict>
+                 <key>Name</key>
                  <string>Commit RemoteLayerTree transaction</string>
                  <key>Type</key>
                  <string>Interval</string>
                  <key>CodeEnd</key>
                  <string>14002</string>
              </dict>
+             <dict>
+                 <key>Name</key>
+                 <string>Process Launch</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>14003</string>
+                 <key>CodeEnd</key>
+                 <string>14004</string>
+             </dict>
          </array>
      </dict>
  </array>
- </plist>
\ No newline at end of file
+ </plist>