Move WebCore CPUTime to WTF and implement it in all the platforms
https://bugs.webkit.org/show_bug.cgi?id=171477
Reviewed by Chris Dumez.
Source/WebCore:
Move CPUTime to WTF. And rename getCPUTime to CPUTime::get().
* CMakeLists.txt:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* page/ChromeClient.h:
* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::PerformanceMonitor):
(WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
(WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
(WebCore::PerformanceMonitor::measureCPUUsageInActivityState):
* page/PerformanceMonitor.h:
* platform/CPUMonitor.cpp:
(WebCore::CPUMonitor::setCPULimit):
(WebCore::CPUMonitor::timerFired):
* platform/CPUMonitor.h:
Source/WebKit2:
We now hold Seconds in CPUTime instead of int64_t. It finally sends
Seconds through WebKit2 IPC. We do not need to specialize ArgumentCoder
for Seconds since Seconds just holds double.
* UIProcess/PerActivityStateCPUUsageSampler.cpp:
(WebKit::PerActivityStateCPUUsageSampler::PerActivityStateCPUUsageSampler):
(WebKit::PerActivityStateCPUUsageSampler::reportWebContentCPUTime):
(WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
* UIProcess/PerActivityStateCPUUsageSampler.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::reportWebContentCPUTime):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessPool.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::reportProcessCPUTime):
* WebProcess/WebCoreSupport/WebChromeClient.h:
Source/WTF:
We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
and it does not depend on any external libraries.
And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CPUTime.cpp: Copied from Source/WebCore/platform/CPUTime.cpp.
(WTF::CPUTime::percentageCPUUsageSince):
* wtf/CPUTime.h: Renamed from Source/WebCore/platform/CPUTime.h.
* wtf/PlatformEfl.cmake:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/cocoa/CPUTimeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm.
(WTF::timeValueToMicroseconds):
(WTF::CPUTime::get):
* wtf/unix/CPUTimeUnix.cpp: Renamed from Source/WebCore/platform/CPUTime.cpp.
(WTF::timevalToSeconds):
(WTF::CPUTime::get):
* wtf/win/CPUTimeWin.cpp: Added.
(WTF::fileTimeToSeconds):
(WTF::CPUTime::get):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215973
268f45cc-cd09-0410-ab3c-
d52691b4dbfc