Skip to content
Permalink
Browse files
Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
https://bugs.webkit.org/show_bug.cgi?id=167471
<rdar://problem/30221723>

Reviewed by Alex Christensen.

Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
to use numeric values for logDiagnosticMessageWithValue().

* UIProcess/PerActivityStateCPUUsageSampler.cpp:
(WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
(WebKit::loggingKeyForCPUUsage): Deleted.

Canonical link: https://commits.webkit.org/184515@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Jan 27, 2017
1 parent 1c44265 commit 634f29665737f15e53aaad70e230a34c0ab82e50
Showing with 18 additions and 14 deletions.
  1. +15 −0 Source/WebKit2/ChangeLog
  2. +3 −14 Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp
@@ -1,3 +1,18 @@
2017-01-26 Chris Dumez <cdumez@apple.com>

Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
https://bugs.webkit.org/show_bug.cgi?id=167471
<rdar://problem/30221723>

Reviewed by Alex Christensen.

Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
to use numeric values for logDiagnosticMessageWithValue().

* UIProcess/PerActivityStateCPUUsageSampler.cpp:
(WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
(WebKit::loggingKeyForCPUUsage): Deleted.

2017-01-26 Jeremy Jones <jeremyj@apple.com>

Request pointer unlock on navigation and re-enable pointer-lock tests for WK2.
@@ -70,17 +70,6 @@ static inline String loggingKeyForActivityState(ActivityStateForCPUSampling stat
}
}

static inline String loggingKeyForCPUUsage(ActivityStateForCPUSampling state, double cpuUsage)
{
switch (state) {
case ActivityStateForCPUSampling::NonVisible:
return DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey(cpuUsage);
case ActivityStateForCPUSampling::VisibleNonActive:
case ActivityStateForCPUSampling::VisibleAndActive:
return DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey(cpuUsage);
}
}

void PerActivityStateCPUUsageSampler::loggingTimerFired()
{
auto* page = pageForLogging();
@@ -94,9 +83,9 @@ void PerActivityStateCPUUsageSampler::loggingTimerFired()

for (auto& pair : m_cpuTimeInActivityState) {
double cpuUsage = static_cast<double>(pair.value * 100.) / cpuTimeDelta;
String loggingKey = loggingKeyForActivityState(pair.key);
page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), loggingKey, loggingKeyForCPUUsage(pair.key, cpuUsage), false);
RELEASE_LOG(PerformanceLogging, "WebContent processes used %.1f%% CPU in %s state", cpuUsage, loggingKey.utf8().data());
String activityStateKey = loggingKeyForActivityState(pair.key);
page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, String::number(cpuUsage, 1), false);
RELEASE_LOG(PerformanceLogging, "WebContent processes used %.1f%% CPU in %s state", cpuUsage, activityStateKey.utf8().data());
}

m_cpuTimeInActivityState.clear();

0 comments on commit 634f296

Please sign in to comment.