Title: [211233] trunk/Source/WebCore
Revision
211233
Author
cdu...@apple.com
Date
2017-01-26 15:33:14 -0800 (Thu, 26 Jan 2017)

Log Message

Fix CPU / Memory diagnostic logging in PerformanceMonitor
https://bugs.webkit.org/show_bug.cgi?id=167469
<rdar://problem/30220959>

Reviewed by Alex Christensen.

Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage()
instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only
be used with numeric values but we already take care of the bucketing on our side.

* page/DiagnosticLoggingClient.h:
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey):
(WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey):
(WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey):
(WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey):
(WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey):
(WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey):
(WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted.
(WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted.
(WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted.
* page/DiagnosticLoggingKeys.h:
* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
(WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
(WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
(WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211232 => 211233)


--- trunk/Source/WebCore/ChangeLog	2017-01-26 22:34:00 UTC (rev 211232)
+++ trunk/Source/WebCore/ChangeLog	2017-01-26 23:33:14 UTC (rev 211233)
@@ -1,3 +1,33 @@
+2017-01-26  Chris Dumez  <cdu...@apple.com>
+
+        Fix CPU / Memory diagnostic logging in PerformanceMonitor
+        https://bugs.webkit.org/show_bug.cgi?id=167469
+        <rdar://problem/30220959>
+
+        Reviewed by Alex Christensen.
+
+        Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage()
+        instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only
+        be used with numeric values but we already take care of the bucketing on our side.
+
+        * page/DiagnosticLoggingClient.h:
+        * page/DiagnosticLoggingKeys.cpp:
+        (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey):
+        (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey):
+        (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey):
+        (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey):
+        (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey):
+        (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey):
+        (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted.
+        (WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted.
+        (WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted.
+        * page/DiagnosticLoggingKeys.h:
+        * page/PerformanceMonitor.cpp:
+        (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
+        (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
+        (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
+        (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
+
 2017-01-26  Brady Eidson  <beid...@apple.com>
 
         Gamepads: Some DPads are still not exposed in the HID backend.

Modified: trunk/Source/WebCore/page/DiagnosticLoggingClient.h (211232 => 211233)


--- trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2017-01-26 22:34:00 UTC (rev 211232)
+++ trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2017-01-26 23:33:14 UTC (rev 211233)
@@ -39,6 +39,7 @@
 public:
     virtual void logDiagnosticMessage(const String& message, const String& description, ShouldSample) = 0;
     virtual void logDiagnosticMessageWithResult(const String& message, const String& description, DiagnosticLoggingResultType, ShouldSample) = 0;
+    // FIXME: rename this to logDiagnosticMessageWithNumericValue().
     virtual void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, ShouldSample) = 0;
 
     static bool shouldLogAfterSampling(ShouldSample);

Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp (211232 => 211233)


--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2017-01-26 22:34:00 UTC (rev 211232)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp	2017-01-26 23:33:14 UTC (rev 211233)
@@ -53,21 +53,31 @@
     return ASCIILiteral("pluginFailedLoading");
 }
 
-String DiagnosticLoggingKeys::postPageBackgroundingKey()
+String DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey()
 {
-    return ASCIILiteral("postPageBackgrounding");
+    return ASCIILiteral("postPageBackgroundingCPUUsage");
 }
 
+String DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey()
+{
+    return ASCIILiteral("postPageBackgroundingMemoryUsage");
+}
+
 String DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey()
 {
     return ASCIILiteral("pageHandlesWebGLContextLoss");
 }
 
-String DiagnosticLoggingKeys::postPageLoadKey()
+String DiagnosticLoggingKeys::postPageLoadCPUUsageKey()
 {
-    return ASCIILiteral("postPageLoad");
+    return ASCIILiteral("postPageLoadCPUUsage");
 }
 
+String DiagnosticLoggingKeys::postPageLoadMemoryUsageKey()
+{
+    return ASCIILiteral("postPageLoadMemoryUsage");
+}
+
 String DiagnosticLoggingKeys::provisionalLoadKey()
 {
     return ASCIILiteral("provisionalLoad");
@@ -338,11 +348,6 @@
     return ASCIILiteral("cpuUsage");
 }
 
-String DiagnosticLoggingKeys::memoryUsageKey()
-{
-    return ASCIILiteral("memoryUsage");
-}
-
 String DiagnosticLoggingKeys::createSharedBufferFailedKey()
 {
     return ASCIILiteral("createSharedBufferFailed");
@@ -718,7 +723,7 @@
 String DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(double cpuUsage)
 {
     if (cpuUsage < 10)
-        return ASCIILiteral("Below10");
+        return ASCIILiteral("below10");
     if (cpuUsage < 20)
         return ASCIILiteral("10to20");
     if (cpuUsage < 40)
@@ -733,7 +738,7 @@
 String DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(double cpuUsage)
 {
     if (cpuUsage < 1)
-        return ASCIILiteral("Below1");
+        return ASCIILiteral("below1");
     if (cpuUsage < 5)
         return ASCIILiteral("1to5");
     if (cpuUsage < 10)

Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.h (211232 => 211233)


--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.h	2017-01-26 22:34:00 UTC (rev 211232)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.h	2017-01-26 23:33:14 UTC (rev 211233)
@@ -41,7 +41,6 @@
     static String canCacheKey();
     static String cannotSuspendActiveDOMObjectsKey();
     WEBCORE_EXPORT static String cpuUsageKey();
-    WEBCORE_EXPORT static String memoryUsageKey();
     WEBCORE_EXPORT static String createSharedBufferFailedKey();
     WEBCORE_EXPORT static String deltaKey();
     static String deniedByClientKey();
@@ -105,8 +104,10 @@
     static String playedKey();
     static String pluginLoadedKey();
     static String pluginLoadingFailedKey();
-    static String postPageBackgroundingKey();
-    static String postPageLoadKey();
+    static String postPageBackgroundingCPUUsageKey();
+    static String postPageBackgroundingMemoryUsageKey();
+    static String postPageLoadCPUUsageKey();
+    static String postPageLoadMemoryUsageKey();
     static String provisionalLoadKey();
     static String prunedDueToMaxSizeReached();
     static String prunedDueToMemoryPressureKey();

Modified: trunk/Source/WebCore/page/PerformanceMonitor.cpp (211232 => 211233)


--- trunk/Source/WebCore/page/PerformanceMonitor.cpp	2017-01-26 22:34:00 UTC (rev 211232)
+++ trunk/Source/WebCore/page/PerformanceMonitor.cpp	2017-01-26 23:33:14 UTC (rev 211233)
@@ -141,7 +141,7 @@
 
     double cpuUsage = cpuTime.value().percentageCPUUsageSince(*m_postLoadCPUTime);
     RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostLoadCPUUsage: Process was using %.1f%% CPU after the page load.", cpuUsage);
-    m_page.diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::postPageLoadKey(), DiagnosticLoggingKeys::cpuUsageKey(), DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
+    m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageLoadCPUUsageKey(), DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
 }
 
 void PerformanceMonitor::measurePostLoadMemoryUsage()
@@ -154,7 +154,7 @@
         return;
 
     RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostLoadMemoryUsage: Process was using %llu bytes of memory after the page load.", memoryUsage.value());
-    m_page.diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::postPageLoadKey(), DiagnosticLoggingKeys::memoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
+    m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageLoadMemoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
 }
 
 void PerformanceMonitor::measurePostBackgroundingMemoryUsage()
@@ -167,7 +167,7 @@
         return;
 
     RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostBackgroundingMemoryUsage: Process was using %llu bytes of memory after becoming non visible.", memoryUsage.value());
-    m_page.diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::postPageBackgroundingKey(), DiagnosticLoggingKeys::memoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
+    m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey(), DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey(memoryUsage.value()), ShouldSample::No);
 }
 
 void PerformanceMonitor::measurePostBackgroundingCPUUsage()
@@ -189,7 +189,7 @@
 
     double cpuUsage = cpuTime.value().percentageCPUUsageSince(*m_postBackgroundingCPUTime);
     RELEASE_LOG_IF_ALLOWED(PerformanceLogging, "measurePostBackgroundingCPUUsage: Process was using %.1f%% CPU after becoming non visible.", cpuUsage);
-    m_page.diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::postPageBackgroundingKey(), DiagnosticLoggingKeys::cpuUsageKey(), DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
+    m_page.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey(), DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(cpuUsage), ShouldSample::No);
 }
 
 void PerformanceMonitor::measurePerActivityStateCPUUsage()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to