Changeset 211295 in webkit


Ignore:
Timestamp:
Jan 27, 2017 12:33:12 PM (7 years ago)
Author:
Chris Dumez
Message:

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):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r211281 r211295  
     12017-01-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Round CPU Usage diagnostic logging to 2 significant digits
     4        https://bugs.webkit.org/show_bug.cgi?id=167515
     5        <rdar://problem/30236297>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Round CPU Usage diagnostic logging to 2 significant digits
     10        as requested by diagnostic logging team.
     11
     12        * UIProcess/PerActivityStateCPUUsageSampler.cpp:
     13        (WebKit::toStringRoundingSignificantFigures):
     14        (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
     15
    1162017-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    217
  • trunk/Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp

    r211239 r211295  
    3131#include "WebProcessProxy.h"
    3232#include <WebCore/DiagnosticLoggingKeys.h>
     33#include <wtf/DecimalNumber.h>
    3334
    3435namespace WebKit {
     
    7172}
    7273
     74static String toStringRoundingSignificantFigures(double value, unsigned significantFigures)
     75{
     76    DecimalNumber decimal(value, RoundingSignificantFigures, significantFigures);
     77    NumberToLStringBuffer buffer;
     78    unsigned length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
     79    return String(buffer, length);
     80}
     81
    7382void PerActivityStateCPUUsageSampler::loggingTimerFired()
    7483{
     
    8594        double cpuUsage = static_cast<double>(pair.value * 100.) / cpuTimeDelta;
    8695        String activityStateKey = loggingKeyForActivityState(pair.key);
    87         page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, String::number(cpuUsage, 1), false);
     96        page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, toStringRoundingSignificantFigures(cpuUsage, 2), false);
    8897        RELEASE_LOG(PerformanceLogging, "WebContent processes used %.1f%% CPU in %s state", cpuUsage, activityStateKey.utf8().data());
    8998    }
Note: See TracChangeset for help on using the changeset viewer.