Title: [195142] trunk
Revision
195142
Author
[email protected]
Date
2016-01-15 12:57:37 -0800 (Fri, 15 Jan 2016)

Log Message

Add kdebug_trace signposts for a few WebCore operations
https://bugs.webkit.org/show_bug.cgi?id=153136
rdar://problem/24208487

Reviewed by Sam Weinig.
Source/WebCore:

Add trace points for style recalc, layout, view painting and layer painting.

* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::paintContents):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::platformCALayerPaintContents):

Source/WTF:

New header with the reserved WebKit component code, trace point codes, and
a stack-based helper that traces scope entry and exit.

The available range of trace point codes is arbitrarily segmented into WTF, JSC,
WebCore, WebKit and WebKit2.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/SystemTracing.h: Added.
(WTF::TraceScope::TraceScope):
(WTF::TraceScope::~TraceScope):

Tools:

Plist used by kdebug_trace() viewing tools.

* Tracing/SystemTracePoints.plist: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (195141 => 195142)


--- trunk/Source/WTF/ChangeLog	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WTF/ChangeLog	2016-01-15 20:57:37 UTC (rev 195142)
@@ -1,3 +1,23 @@
+2016-01-15  Simon Fraser  <[email protected]>
+
+        Add kdebug_trace signposts for a few WebCore operations
+        https://bugs.webkit.org/show_bug.cgi?id=153136
+        rdar://problem/24208487
+
+        Reviewed by Sam Weinig.
+        
+        New header with the reserved WebKit component code, trace point codes, and
+        a stack-based helper that traces scope entry and exit.
+        
+        The available range of trace point codes is arbitrarily segmented into WTF, JSC,
+        WebCore, WebKit and WebKit2.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/SystemTracing.h: Added.
+        (WTF::TraceScope::TraceScope):
+        (WTF::TraceScope::~TraceScope):
+
 2016-01-15  Andreas Kling  <[email protected]>
 
         Fragmentation-free allocator for timeless and/or coupled allocations.

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (195141 => 195142)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2016-01-15 20:57:37 UTC (rev 195142)
@@ -269,6 +269,7 @@
     <ClInclude Include="..\wtf\Stopwatch.h" />
     <ClInclude Include="..\wtf\StringExtras.h" />
     <ClInclude Include="..\wtf\StringPrintStream.h" />
+    <ClInclude Include="..\wtf\SystemTracing.h" />
     <ClInclude Include="..\wtf\TemporaryChange.h" />
     <ClInclude Include="..\wtf\text\ASCIIFastPath.h" />
     <ClInclude Include="..\wtf\text\AtomicString.h" />

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (195141 => 195142)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2016-01-15 20:57:37 UTC (rev 195142)
@@ -41,6 +41,7 @@
 		0F9D3363165DBA73005AD387 /* PrintStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9D335E165DBA73005AD387 /* PrintStream.h */; };
 		0FB14E19180FA218009B6B4D /* Bag.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB14E18180FA218009B6B4D /* Bag.h */; };
 		0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB14E1A1810E1DA009B6B4D /* BagToHashMap.h */; };
+		0FB317C41C488001007E395A /* SystemTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB317C31C488001007E395A /* SystemTracing.h */; };
 		0FC4488316FE9FE100844BE9 /* ProcessID.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC4488216FE9FE100844BE9 /* ProcessID.h */; };
 		0FC4EDE61696149600F65041 /* CommaPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC4EDE51696149600F65041 /* CommaPrinter.h */; };
 		0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD81AC4154FB22E00983E72 /* FastBitVector.h */; settings = {ATTRIBUTES = (); }; };
@@ -346,6 +347,7 @@
 		0F9D335E165DBA73005AD387 /* PrintStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintStream.h; sourceTree = "<group>"; };
 		0FB14E18180FA218009B6B4D /* Bag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bag.h; sourceTree = "<group>"; };
 		0FB14E1A1810E1DA009B6B4D /* BagToHashMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BagToHashMap.h; sourceTree = "<group>"; };
+		0FB317C31C488001007E395A /* SystemTracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemTracing.h; sourceTree = "<group>"; };
 		0FC4488216FE9FE100844BE9 /* ProcessID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessID.h; sourceTree = "<group>"; };
 		0FC4EDE51696149600F65041 /* CommaPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommaPrinter.h; sourceTree = "<group>"; };
 		0FD81AC4154FB22E00983E72 /* FastBitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastBitVector.h; sourceTree = "<group>"; };
@@ -921,6 +923,7 @@
 				A748745117A0BDAE00FA04CB /* StringHashDumpContext.h */,
 				0FDDBFA51666DFA300C55FEF /* StringPrintStream.cpp */,
 				0FDDBFA61666DFA300C55FEF /* StringPrintStream.h */,
+				0FB317C31C488001007E395A /* SystemTracing.h */,
 				A8A4731A151A825B004123FF /* TemporaryChange.h */,
 				A8A4732F151A825B004123FF /* ThreadFunctionInvocation.h */,
 				A8A47330151A825B004123FF /* ThreadIdentifierDataPthreads.cpp */,
@@ -1190,6 +1193,7 @@
 				A8A473DC151A825B004123FF /* InlineASM.h in Headers */,
 				A70DA0841799F04D00529A9B /* Insertion.h in Headers */,
 				26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */,
+				0FB317C41C488001007E395A /* SystemTracing.h in Headers */,
 				7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */,
 				7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */,
 				93AC91A818942FC400244939 /* LChar.h in Headers */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (195141 => 195142)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2016-01-15 20:57:37 UTC (rev 195142)
@@ -99,6 +99,7 @@
     Stopwatch.h
     StringExtras.h
     StringPrintStream.h
+    SystemTracing.h
     ThreadIdentifierDataPthreads.h
     ThreadSafeRefCounted.h
     ThreadSpecific.h

Added: trunk/Source/WTF/wtf/SystemTracing.h (0 => 195142)


--- trunk/Source/WTF/wtf/SystemTracing.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/SystemTracing.h	2016-01-15 20:57:37 UTC (rev 195142)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SystemTracing_h
+#define SystemTracing_h
+
+#if defined(__has_include) && __has_include(<System/sys/kdebug.h>)
+#include <System/sys/kdebug.h>
+#define HAVE_KDEBUG_H 1
+#endif
+
+// No namespaces because this file has to be includable from C and Objective-C.
+
+// Reserved component code. Do not change this.
+#define WEBKIT_COMPONENT 47
+
+// Trace point codes can be up to 14 bits (0-16383).
+// When adding or changing these codes, update Tools/Tracing/SystemTracePoints.plist to match.
+enum TracePointCode {
+    WTFRange = 0,
+
+    _javascript_Range = 2500,
+
+    WebCoreRange = 5000,
+    StyleRecalcStart,
+    StyleRecalcEnd,
+    LayoutStart,
+    LayoutEnd,
+    PaintViewStart,
+    PaintViewEnd,
+    PaintLayerStart,
+    PaintLayerEnd,
+
+    WebKitRange = 10000,
+    WebKit2Range = 12000,
+};
+
+#ifdef __cplusplus
+
+namespace WTF {
+
+class TraceScope {
+public:
+
+#if HAVE(KDEBUG_H)
+    TraceScope(TracePointCode entryCode, TracePointCode exitCode)
+        : m_exitCode(exitCode)
+    {
+        kdebug_trace(ARIADNEDBG_CODE(WEBKIT_COMPONENT, entryCode), 0, 0, 0, 0);
+    }
+#else
+    TraceScope(TracePointCode, TracePointCode)
+    {
+    }
+#endif
+    
+    ~TraceScope()
+    {
+#if HAVE(KDEBUG_H)
+        kdebug_trace(ARIADNEDBG_CODE(WEBKIT_COMPONENT, m_exitCode), 0, 0, 0, 0);
+#endif
+    }
+
+private:
+#if HAVE(KDEBUG_H)
+    TracePointCode m_exitCode;
+#endif
+};
+
+} // namespace WTF
+
+using WTF::TraceScope;
+
+#endif // __cplusplus
+
+#endif // SystemTracing_h
+

Modified: trunk/Source/WebCore/ChangeLog (195141 => 195142)


--- trunk/Source/WebCore/ChangeLog	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WebCore/ChangeLog	2016-01-15 20:57:37 UTC (rev 195142)
@@ -1,3 +1,21 @@
+2016-01-15  Simon Fraser  <[email protected]>
+
+        Add kdebug_trace signposts for a few WebCore operations
+        https://bugs.webkit.org/show_bug.cgi?id=153136
+        rdar://problem/24208487
+
+        Reviewed by Sam Weinig.
+
+        Add trace points for style recalc, layout, view painting and layer painting.
+
+        * dom/Document.cpp:
+        (WebCore::Document::recalcStyle):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::paintContents):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
+
 2016-01-15  Andreas Kling  <[email protected]>
 
         Use BumpArena for style sheet object tree.

Modified: trunk/Source/WebCore/dom/Document.cpp (195141 => 195142)


--- trunk/Source/WebCore/dom/Document.cpp	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-01-15 20:57:37 UTC (rev 195142)
@@ -180,6 +180,7 @@
 #include <inspector/ScriptCallStack.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/NeverDestroyed.h>
+#include <wtf/SystemTracing.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/StringBuffer.h>
 #include <yarr/RegularExpression.h>
@@ -1823,6 +1824,8 @@
     if (m_inStyleRecalc)
         return; // Guard against re-entrancy. -dwh
 
+    TraceScope tracingScope(StyleRecalcStart, StyleRecalcEnd);
+
     RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView());
     AnimationUpdateBlock animationUpdateBlock(&m_frame->animation());
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (195141 => 195142)


--- trunk/Source/WebCore/page/FrameView.cpp	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WebCore/page/FrameView.cpp	2016-01-15 20:57:37 UTC (rev 195142)
@@ -93,6 +93,7 @@
 
 #include <wtf/CurrentTime.h>
 #include <wtf/Ref.h>
+#include <wtf/SystemTracing.h>
 #include <wtf/TemporaryChange.h>
 
 #if USE(COORDINATED_GRAPHICS)
@@ -1236,6 +1237,8 @@
         if (!root || !root->needsLayout())
             return;
     }
+    
+    TraceScope tracingScope(LayoutStart, LayoutEnd);
 
 #if PLATFORM(IOS)
     if (updateFixedPositionLayoutRect())
@@ -4014,7 +4017,9 @@
 
     if (m_layoutPhase == InViewSizeAdjust)
         return;
-    
+
+    TraceScope tracingScope(PaintViewStart, PaintViewEnd);
+
     ASSERT(m_layoutPhase == InPostLayerPositionsUpdatedAfterLayout || m_layoutPhase == OutsideLayout);
     
     RenderView* renderView = this->renderView();

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (195141 => 195142)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-01-15 20:57:37 UTC (rev 195142)
@@ -47,6 +47,7 @@
 #include <limits.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/MathExtras.h>
+#include <wtf/SystemTracing.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/WTFString.h>
 
@@ -1446,6 +1447,8 @@
         replayer.replay(clip);
         return;
     }
+
+    TraceScope tracingScope(PaintLayerStart, PaintLayerEnd);
     paintGraphicsLayerContents(context, clip);
 }
 

Modified: trunk/Tools/ChangeLog (195141 => 195142)


--- trunk/Tools/ChangeLog	2016-01-15 20:01:42 UTC (rev 195141)
+++ trunk/Tools/ChangeLog	2016-01-15 20:57:37 UTC (rev 195142)
@@ -1,3 +1,15 @@
+2016-01-15  Simon Fraser  <[email protected]>
+
+        Add kdebug_trace signposts for a few WebCore operations
+        https://bugs.webkit.org/show_bug.cgi?id=153136
+        rdar://problem/24208487
+
+        Reviewed by Sam Weinig.
+        
+        Plist used by kdebug_trace() viewing tools.
+
+        * Tracing/SystemTracePoints.plist: Added.
+
 2016-01-14  Konstantin Tokarev  <[email protected]>
 
         [webkitdirs] Replaced grep invocation with perl code

Added: trunk/Tools/Tracing/SystemTracePoints.plist (0 => 195142)


--- trunk/Tools/Tracing/SystemTracePoints.plist	                        (rev 0)
+++ trunk/Tools/Tracing/SystemTracePoints.plist	2016-01-15 20:57:37 UTC (rev 195142)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <array>
+     <dict>
+         <key>Name</key>
+         <string>WebKit</string>
+         <key>Children</key>
+         <array>
+             <dict>
+                 <key>Name</key>
+                 <string>Document::recalcStyle()</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>5001</string>
+                 <key>CodeEnd</key>
+                 <string>5002</string>
+             </dict>
+             <dict>
+                 <key>Name</key>
+                 <string>FrameView::layout()</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>5003</string>
+                 <key>CodeEnd</key>
+                 <string>5004</string>
+             </dict>
+             <dict>
+                 <key>Name</key>
+                 <string>FrameView::paintContents()</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>5005</string>
+                 <key>CodeEnd</key>
+                 <string>5006</string>
+             </dict>
+             <dict>
+                 <key>Name</key>
+                 <string>GraphicsLayerCA::paintLayerContents()</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>5007</string>
+                 <key>CodeEnd</key>
+                 <string>5008</string>
+             </dict>
+         </array>
+     </dict>
+ </array>
+ </plist>
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to