Title: [215123] trunk/Source
Revision
215123
Author
cdu...@apple.com
Date
2017-04-07 15:22:24 -0700 (Fri, 07 Apr 2017)

Log Message

We should log how much CPU a background process was using when killing it due to CPU limiting
https://bugs.webkit.org/show_bug.cgi?id=170619

Reviewed by Andreas Kling.

Source/WebCore:

CPUMonitor now passes the CPU usage to the callback when it exceeds the threashold.

* platform/CPUMonitor.cpp:
(WebCore::CPUMonitor::timerFired):
* platform/CPUMonitor.h:

Source/WebKit2:

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::updateBackgroundCPUMonitorState):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215122 => 215123)


--- trunk/Source/WebCore/ChangeLog	2017-04-07 22:13:22 UTC (rev 215122)
+++ trunk/Source/WebCore/ChangeLog	2017-04-07 22:22:24 UTC (rev 215123)
@@ -1,5 +1,18 @@
 2017-04-07  Chris Dumez  <cdu...@apple.com>
 
+        We should log how much CPU a background process was using when killing it due to CPU limiting
+        https://bugs.webkit.org/show_bug.cgi?id=170619
+
+        Reviewed by Andreas Kling.
+
+        CPUMonitor now passes the CPU usage to the callback when it exceeds the threashold.
+
+        * platform/CPUMonitor.cpp:
+        (WebCore::CPUMonitor::timerFired):
+        * platform/CPUMonitor.h:
+
+2017-04-07  Chris Dumez  <cdu...@apple.com>
+
         Audible autoplay videos should not get paused when outside the viewport
         https://bugs.webkit.org/show_bug.cgi?id=170610
         <rdar://problem/31505984>

Modified: trunk/Source/WebCore/platform/CPUMonitor.cpp (215122 => 215123)


--- trunk/Source/WebCore/platform/CPUMonitor.cpp	2017-04-07 22:13:22 UTC (rev 215122)
+++ trunk/Source/WebCore/platform/CPUMonitor.cpp	2017-04-07 22:22:24 UTC (rev 215123)
@@ -65,7 +65,7 @@
 
     auto cpuUsagePercent = cpuTime.value().percentageCPUUsageSince(m_lastCPUTime.value());
     if (cpuUsagePercent > m_cpuLimit.value() * 100)
-        m_exceededCPULimitHandler();
+        m_exceededCPULimitHandler(cpuUsagePercent / 100.);
 
     m_lastCPUTime = cpuTime;
 }

Modified: trunk/Source/WebCore/platform/CPUMonitor.h (215122 => 215123)


--- trunk/Source/WebCore/platform/CPUMonitor.h	2017-04-07 22:13:22 UTC (rev 215122)
+++ trunk/Source/WebCore/platform/CPUMonitor.h	2017-04-07 22:22:24 UTC (rev 215123)
@@ -34,7 +34,7 @@
 
 class CPUMonitor {
 public:
-    using ExceededCPULimitHandler = WTF::Function<void()>;
+    using ExceededCPULimitHandler = WTF::Function<void(double)>;
     WEBCORE_EXPORT CPUMonitor(Seconds checkInterval, ExceededCPULimitHandler&&);
 
     WEBCORE_EXPORT void setCPULimit(std::optional<double>);

Modified: trunk/Source/WebKit2/ChangeLog (215122 => 215123)


--- trunk/Source/WebKit2/ChangeLog	2017-04-07 22:13:22 UTC (rev 215122)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-07 22:22:24 UTC (rev 215123)
@@ -1,3 +1,13 @@
+2017-04-07  Chris Dumez  <cdu...@apple.com>
+
+        We should log how much CPU a background process was using when killing it due to CPU limiting
+        https://bugs.webkit.org/show_bug.cgi?id=170619
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::updateBackgroundCPUMonitorState):
+
 2017-04-07  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Missing conversion from window to content coordinates when adjusting unobscured content rects for input view

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (215122 => 215123)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2017-04-07 22:13:22 UTC (rev 215122)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2017-04-07 22:22:24 UTC (rev 215123)
@@ -430,8 +430,8 @@
     }
 
     if (!m_backgroundCPUMonitor) {
-        m_backgroundCPUMonitor = std::make_unique<CPUMonitor>(backgroundCPUMonitoringInterval, [this] {
-            RELEASE_LOG(PerformanceLogging, "%p - WebProcess exceeded background CPU limit of %.1f%%", this, m_backgroundCPULimit.value() * 100);
+        m_backgroundCPUMonitor = std::make_unique<CPUMonitor>(backgroundCPUMonitoringInterval, [this](double cpuUsage) {
+            RELEASE_LOG(PerformanceLogging, "%p - WebProcess exceeded background CPU limit of %.1f%% (was using %.1f%%)", this, m_backgroundCPULimit.value() * 100, cpuUsage * 100);
             parentProcessConnection()->send(Messages::WebProcessProxy::DidExceedBackgroundCPULimit(), 0);
         });
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to