Title: [211513] branches/safari-603-branch/Source/WebKit2
Revision
211513
Author
matthew_han...@apple.com
Date
2017-02-01 13:26:23 -0800 (Wed, 01 Feb 2017)

Log Message

Merge r211295. rdar://problem/30236297

Modified Paths

Diff

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (211512 => 211513)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-01 21:26:21 UTC (rev 211512)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-01 21:26:23 UTC (rev 211513)
@@ -1,3 +1,22 @@
+2017-01-31  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211295. rdar://problem/30236297
+
+    2017-01-27  Chris Dumez  <cdu...@apple.com>
+
+            Round CPU Usage diagnostic logging to 2 significant digits
+            https://bugs.webkit.org/show_bug.cgi?id=167515
+            <rdar://problem/30236297>
+
+            Reviewed by Antti Koivisto.
+
+            Round CPU Usage diagnostic logging to 2 significant digits
+            as requested by diagnostic logging team.
+
+            * UIProcess/PerActivityStateCPUUsageSampler.cpp:
+            (WebKit::toStringRoundingSignificantFigures):
+            (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
+
 2017-01-26  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211239. rdar://problem/30221723

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp (211512 => 211513)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp	2017-02-01 21:26:21 UTC (rev 211512)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp	2017-02-01 21:26:23 UTC (rev 211513)
@@ -30,6 +30,7 @@
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
 #include <WebCore/DiagnosticLoggingKeys.h>
+#include <wtf/DecimalNumber.h>
 
 namespace WebKit {
 
@@ -70,6 +71,14 @@
     }
 }
 
+static String toStringRoundingSignificantFigures(double value, unsigned significantFigures)
+{
+    DecimalNumber decimal(value, RoundingSignificantFigures, significantFigures);
+    NumberToLStringBuffer buffer;
+    unsigned length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
+    return String(buffer, length);
+}
+
 void PerActivityStateCPUUsageSampler::loggingTimerFired()
 {
     auto* page = pageForLogging();
@@ -84,7 +93,7 @@
     for (auto& pair : m_cpuTimeInActivityState) {
         double cpuUsage = static_cast<double>(pair.value * 100.) / cpuTimeDelta;
         String activityStateKey = loggingKeyForActivityState(pair.key);
-        page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, String::number(cpuUsage, 1), false);
+        page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, toStringRoundingSignificantFigures(cpuUsage, 2), false);
         RELEASE_LOG(PerformanceLogging, "WebContent processes used %.1f%% CPU in %s state", cpuUsage, activityStateKey.utf8().data());
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to