Add a system trace point for memory warning handling
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Mar 2017 02:04:59 +0000 (02:04 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Mar 2017 02:04:59 +0000 (02:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169893

Reviewed by Zalan Bujtas.

Source/WebCore:

Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.

* page/MemoryRelease.cpp:
(WebCore::releaseMemory):

Source/WTF:

Make it possible to pass data to the Begin trace point.

* wtf/SystemTracing.h:
(WTF::TraceScope::TraceScope):

Tools:

Describe the new trace points.

* Tracing/SystemTracePoints.plist:

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

Source/WTF/ChangeLog
Source/WTF/wtf/SystemTracing.h
Source/WebCore/ChangeLog
Source/WebCore/page/MemoryRelease.cpp
Tools/ChangeLog
Tools/Tracing/SystemTracePoints.plist

index 59a9c69..6670c41 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-20  Simon Fraser  <simon.fraser@apple.com>
+
+        Add a system trace point for memory warning handling
+        https://bugs.webkit.org/show_bug.cgi?id=169893
+
+        Reviewed by Zalan Bujtas.
+
+        Make it possible to pass data to the Begin trace point.
+
+        * wtf/SystemTracing.h:
+        (WTF::TraceScope::TraceScope):
+
 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Time channel attack on SVG Filters
index 1ee67d3..be41edc 100644 (file)
@@ -67,6 +67,8 @@ enum TracePointCode {
     AsyncImageDecodeEnd,
     RAFCallbackStart,
     RAFCallbackEnd,
+    MemoryPressureHandlerStart,
+    MemoryPressureHandlerEnd,
 
     WebKitRange = 10000,
     WebHTMLViewPaintStart,
@@ -107,10 +109,10 @@ inline void TracePoint(TracePointCode code, uint64_t data1 = 0, uint64_t data2 =
 class TraceScope {
 public:
 
-    TraceScope(TracePointCode entryCode, TracePointCode exitCode)
+    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);
+        TracePoint(entryCode, data1, data2, data3, data4);
     }
 
     ~TraceScope()
index 9a53155..ea7ec26 100644 (file)
@@ -1,5 +1,17 @@
 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
 
+        Add a system trace point for memory warning handling
+        https://bugs.webkit.org/show_bug.cgi?id=169893
+
+        Reviewed by Zalan Bujtas.
+
+        Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.
+
+        * page/MemoryRelease.cpp:
+        (WebCore::releaseMemory):
+
+2017-03-20  Simon Fraser  <simon.fraser@apple.com>
+
         Optimize packing of Document and superclass data members
         https://bugs.webkit.org/show_bug.cgi?id=169880
 
index 36612a8..da0a966 100644 (file)
@@ -47,6 +47,7 @@
 #include "StyledElement.h"
 #include "WorkerThread.h"
 #include <wtf/FastMalloc.h>
+#include <wtf/SystemTracing.h>
 
 #if PLATFORM(COCOA)
 #include "ResourceUsageThread.h"
@@ -112,6 +113,8 @@ static void releaseCriticalMemory(Synchronous synchronous)
 
 void releaseMemory(Critical critical, Synchronous synchronous)
 {
+    TraceScope scope(MemoryPressureHandlerStart, MemoryPressureHandlerEnd, static_cast<uint64_t>(critical), static_cast<uint64_t>(synchronous));
+
     if (critical == Critical::Yes)
         releaseCriticalMemory(synchronous);
 
index 949fc45..0677082 100644 (file)
@@ -1,3 +1,14 @@
+2017-03-20  Simon Fraser  <simon.fraser@apple.com>
+
+        Add a system trace point for memory warning handling
+        https://bugs.webkit.org/show_bug.cgi?id=169893
+
+        Reviewed by Zalan Bujtas.
+
+        Describe the new trace points.
+
+        * Tracing/SystemTracePoints.plist:
+
 2017-03-20  Alex Christensen  <achristensen@webkit.org>
 
         WebPageProxy DecidePolicyForNavigationAction and DecidePolicyForResponseSync should be Delayed reply messages
index b3141e6..9dfdf8b 100644 (file)
              </dict>
              <dict>
                  <key>Name</key>
+                 <string>Memory pressure handler</string>
+                 <key>Type</key>
+                 <string>Interval</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>CodeBegin</key>
+                 <string>5019</string>
+                 <key>CodeEnd</key>
+                 <string>5020</string>
+                 <key>ArgNamesBegin</key>
+                 <dict>
+                     <key>Arg1</key>
+                     <string>Critical</string>
+                     <key>Arg2</key>
+                     <string>Synchronous</string>
+                 </dict>
+             </dict>
+             <dict>
+                 <key>Name</key>
                  <string>Paint WebHTMLView</string>
                  <key>Type</key>
                  <string>Interval</string>