Move WebCore CPUTime to WTF and implement it in all the platforms
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Apr 2017 18:03:22 +0000 (18:03 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Apr 2017 18:03:22 +0000 (18:03 +0000)
commit95193b7c16d557a724ef5a1f1c8db6c94c2f7c2f
tree569102a79641cae612406952cede21acae64cab7
parent651dc9cadf67dd2b57b79460be00e580222e8471
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
30 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/CPUTime.cpp [moved from Source/WebCore/platform/CPUTime.cpp with 83% similarity]
Source/WTF/wtf/CPUTime.h [moved from Source/WebCore/platform/CPUTime.h with 81% similarity]
Source/WTF/wtf/PlatformEfl.cmake
Source/WTF/wtf/PlatformGTK.cmake
Source/WTF/wtf/PlatformJSCOnly.cmake
Source/WTF/wtf/PlatformMac.cmake
Source/WTF/wtf/PlatformWin.cmake
Source/WTF/wtf/cocoa/CPUTimeCocoa.mm [moved from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm with 92% similarity]
Source/WTF/wtf/unix/CPUTimeUnix.cpp [new file with mode: 0644]
Source/WTF/wtf/win/CPUTimeWin.cpp [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PlatformMac.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/PerformanceMonitor.cpp
Source/WebCore/page/PerformanceMonitor.h
Source/WebCore/platform/CPUMonitor.cpp
Source/WebCore/platform/CPUMonitor.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp
Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.h
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/UIProcess/WebProcessPool.messages.in
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h