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

index f5ff3bf..61da47c 100644 (file)
@@ -1,3 +1,36 @@
+2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        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.
+
+        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):
+
 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
 
         Add system trace points for Document::updateTouchEventRegions()
index b8d028c..c2871af 100644 (file)
                E3200AB71E9A536D003B59D2 /* PlatformRegisters.h in Headers */ = {isa = PBXBuildFile; fileRef = E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */; };
                E3200AB81E9A536D003B59D2 /* ThreadHolder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3200AB51E9A536D003B59D2 /* ThreadHolder.cpp */; };
                E3200AB91E9A536D003B59D2 /* ThreadHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = E3200AB61E9A536D003B59D2 /* ThreadHolder.h */; };
+               E38C41251EB4E04C0042957D /* CPUTimeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */; };
+               E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38C41261EB4E0680042957D /* CPUTime.cpp */; };
+               E38C41291EB4E0680042957D /* CPUTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E38C41271EB4E0680042957D /* CPUTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E3E158261EADA53C004A079D /* SystemFree.h in Headers */ = {isa = PBXBuildFile; fileRef = E3E158251EADA53C004A079D /* SystemFree.h */; };
                E43A46951E228B9100276B05 /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A46901E228B9100276B05 /* Decoder.h */; };
                E43A46961E228B9100276B05 /* Encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A46911E228B9100276B05 /* Encoder.h */; };
                E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformRegisters.h; sourceTree = "<group>"; };
                E3200AB51E9A536D003B59D2 /* ThreadHolder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadHolder.cpp; sourceTree = "<group>"; };
                E3200AB61E9A536D003B59D2 /* ThreadHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadHolder.h; sourceTree = "<group>"; };
+               E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CPUTimeCocoa.mm; sourceTree = "<group>"; };
+               E38C41261EB4E0680042957D /* CPUTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUTime.cpp; sourceTree = "<group>"; };
+               E38C41271EB4E0680042957D /* CPUTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUTime.h; sourceTree = "<group>"; };
                E3E158251EADA53C004A079D /* SystemFree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemFree.h; sourceTree = "<group>"; };
                E43A46901E228B9100276B05 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
                E43A46911E228B9100276B05 /* Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Encoder.h; sourceTree = "<group>"; };
                                0F4570441BE834410062A629 /* BubbleSort.h */,
                                A8A47267151A825A004123FF /* BumpPointerAllocator.h */,
                                EB95E1EF161A72410089A2F5 /* ByteOrder.h */,
+                               E38C41261EB4E0680042957D /* CPUTime.cpp */,
+                               E38C41271EB4E0680042957D /* CPUTime.h */,
                                A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
                                A8A4726B151A825A004123FF /* CheckedBoolean.h */,
                                0F66B2801DC97BAB004A1D3F /* ClockType.cpp */,
                E4A0AD3B1A96251900536DF6 /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
+                               E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */,
                                AD89B6B91E64150F0090707F /* MemoryPressureHandlerCocoa.mm */,
                                E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */,
                        );
                                E3200AB71E9A536D003B59D2 /* PlatformRegisters.h in Headers */,
                                0F3501641BB258D500F0A2A3 /* WeakRandom.h in Headers */,
                                1FA47C8B152502DA00568D1B /* WebCoreThread.h in Headers */,
+                               E38C41291EB4E0680042957D /* CPUTime.h in Headers */,
                                0FE4479D1B7AAA03009498EB /* WordLock.h in Headers */,
                                E4A0AD3A1A96245500536DF6 /* WorkQueue.h in Headers */,
                                A8A47446151A825B004123FF /* WTFString.h in Headers */,
                                9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */,
                                1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */,
                                0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */,
+                               E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */,
                                8134013815B092FD001FF0B8 /* Base64.cpp in Sources */,
                                A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */,
                                A8A473AA151A825B004123FF /* bignum.cc in Sources */,
                                2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */,
                                A8A473D8151A825B004123FF /* HashTable.cpp in Sources */,
                                0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */,
+                               E38C41251EB4E04C0042957D /* CPUTimeCocoa.mm in Sources */,
                                0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */,
                                A8A473E5151A825B004123FF /* MainThread.cpp in Sources */,
                                A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */,
index 8e44390..6d74cca 100644 (file)
@@ -12,6 +12,7 @@ set(WTF_HEADERS
     BubbleSort.h
     BumpPointerAllocator.h
     ByteOrder.h
+    CPUTime.h
     ClockType.h
     CompilationThread.h
     Compiler.h
@@ -202,6 +203,7 @@ set(WTF_SOURCES
     Atomics.cpp
     AutomaticThread.cpp
     BitVector.cpp
+    CPUTime.cpp
     ClockType.cpp
     CompilationThread.cpp
     CrossThreadCopier.cpp
similarity index 83%
rename from Source/WebCore/platform/CPUTime.cpp
rename to Source/WTF/wtf/CPUTime.cpp
index 2264409..1d1a037 100644 (file)
 #include "config.h"
 #include "CPUTime.h"
 
-namespace WebCore {
+namespace WTF {
 
-#if !PLATFORM(COCOA)
-
-std::optional<CPUTime> getCPUTime()
-{
-    return std::nullopt;
-}
-
-#endif
-
-double CPUTime::percentageCPUUsageSince(const CPUTime& reference)
+double CPUTime::percentageCPUUsageSince(const CPUTime& reference) const
 {
-    int64_t cpuUsageTimeDelta = (systemTime + userTime) - (reference.systemTime + reference.userTime);
-    int64_t cpuTimeDelta = cpuTime - reference.cpuTime;
+    Seconds cpuUsageTimeDelta = (systemTime + userTime) - (reference.systemTime + reference.userTime);
+    Seconds cpuTimeDelta = cpuTime - reference.cpuTime;
     ASSERT(cpuTimeDelta);
-    return static_cast<double>(cpuUsageTimeDelta * 100.0) / cpuTimeDelta;
+    return cpuUsageTimeDelta.value() * 100.0 / cpuTimeDelta.value();
 }
 
 }
similarity index 81%
rename from Source/WebCore/platform/CPUTime.h
rename to Source/WTF/wtf/CPUTime.h
index d2d50be..1f3958b 100644 (file)
 
 #pragma once
 
+#include <wtf/MonotonicTime.h>
 #include <wtf/Optional.h>
+#include <wtf/Seconds.h>
 
-namespace WebCore {
+namespace WTF {
 
 struct CPUTime {
-    int64_t cpuTime; // in microseconds.
-    int64_t userTime; // in microseconds.
-    int64_t systemTime; // in microseconds.
+    MonotonicTime cpuTime;
+    Seconds userTime;
+    Seconds systemTime;
 
-    double percentageCPUUsageSince(const CPUTime&);
+    WTF_EXPORT_PRIVATE double percentageCPUUsageSince(const CPUTime&) const;
+
+    WTF_EXPORT_PRIVATE static std::optional<CPUTime> get();
 };
 
-std::optional<CPUTime> getCPUTime();
+} // namespace WTF
 
-} // namespace WebCore
+using WTF::CPUTime;
index 3bfce40..aea2ad9 100644 (file)
@@ -13,6 +13,8 @@ list(APPEND WTF_SOURCES
 
     linux/CurrentProcessMemoryStatus.cpp
     linux/MemoryPressureHandlerLinux.cpp
+
+    unix/CPUTimeUnix.cpp
 )
 
 list(APPEND WTF_LIBRARIES
index 0959dba..8450163 100644 (file)
@@ -11,6 +11,8 @@ list(APPEND WTF_SOURCES
     linux/CurrentProcessMemoryStatus.cpp
     linux/MemoryPressureHandlerLinux.cpp
 
+    unix/CPUTimeUnix.cpp
+
     PlatformUserPreferredLanguagesUnix.cpp
     UniStdExtras.cpp
 
index 9d84958..8d3035f 100644 (file)
@@ -6,10 +6,12 @@ list(APPEND WTF_SOURCES
 
 if (WIN32)
     list(APPEND WTF_SOURCES
+        win/CPUTimeWin.cpp
         text/win/TextBreakIteratorInternalICUWin.cpp
     )
 else ()
     list(APPEND WTF_SOURCES
+        unix/CPUTimeUnix.cpp
         text/unix/TextBreakIteratorInternalICUUnix.cpp
     )
 endif ()
index a57623d..83e987e 100644 (file)
@@ -22,6 +22,7 @@ list(APPEND WTF_SOURCES
 
     cf/RunLoopCF.cpp
 
+    cocoa/CPUTimeCocoa.mm
     cocoa/MemoryPressureHandlerCocoa.mm
     cocoa/WorkQueueCocoa.cpp
 
index 60288b7..95d33c2 100644 (file)
@@ -8,6 +8,7 @@ list(APPEND WTF_SOURCES
     text/cf/StringImplCF.cpp
     text/cf/StringViewCF.cpp
 
+    win/CPUTimeWin.cpp
     win/MainThreadWin.cpp
     win/MemoryPressureHandlerWin.cpp
     win/RunLoopWin.cpp
similarity index 92%
rename from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm
rename to Source/WTF/wtf/cocoa/CPUTimeCocoa.mm
index e1b1119..257d8ab 100644 (file)
@@ -29,9 +29,8 @@
 #import <mach/mach_init.h>
 #import <mach/task.h>
 #import <mach/task_info.h>
-#import <wtf/CurrentTime.h>
 
-namespace WebCore {
+namespace WTF {
 
 static const int64_t microsecondsPerSecond = 1000000;
 
@@ -43,7 +42,7 @@ static int64_t timeValueToMicroseconds(const time_value_t& value)
     return result;
 }
 
-std::optional<CPUTime> getCPUTime()
+std::optional<CPUTime> CPUTime::get()
 {
     // Account for current threads.
     task_thread_times_info threadInfoData;
@@ -65,7 +64,7 @@ std::optional<CPUTime> getCPUTime()
     userTime += timeValueToMicroseconds(taskInfoData.user_time);
     systemTime += timeValueToMicroseconds(taskInfoData.system_time);
 
-    return CPUTime { static_cast<int64_t>(monotonicallyIncreasingTime() * microsecondsPerSecond), userTime, systemTime };
+    return CPUTime { MonotonicTime::now(), Seconds::fromMicroseconds(userTime), Seconds::fromMicroseconds(systemTime) };
 }
 
 }
diff --git a/Source/WTF/wtf/unix/CPUTimeUnix.cpp b/Source/WTF/wtf/unix/CPUTimeUnix.cpp
new file mode 100644 (file)
index 0000000..9752b1b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CPUTime.h"
+
+#include <sys/resource.h>
+#include <sys/time.h>
+
+namespace WTF {
+
+static Seconds timevalToSeconds(const struct timeval& value)
+{
+    return Seconds(value.tv_sec) + Seconds::fromMicroseconds(value.tv_usec);
+}
+
+std::optional<CPUTime> CPUTime::get()
+{
+    struct rusage resource { };
+    int ret = getrusage(RUSAGE_SELF, &resource);
+    ASSERT_UNUSED(ret, !ret);
+    return CPUTime { MonotonicTime::now(), timevalToSeconds(resource.ru_utime), timevalToSeconds(resource.ru_stime) };
+}
+
+}
diff --git a/Source/WTF/wtf/win/CPUTimeWin.cpp b/Source/WTF/wtf/win/CPUTimeWin.cpp
new file mode 100644 (file)
index 0000000..fe0dae5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CPUTime.h"
+
+#include <windows.h>
+
+namespace WTF {
+
+static Seconds fileTimeToSeconds(const FILETIME& fileTime)
+{
+    // https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms683223(v=vs.85).aspx
+    // "All times are expressed using FILETIME data structures. Such a structure contains
+    // two 32-bit values that combine to form a 64-bit count of 100-nanosecond time units."
+
+    const constexpr double hundredsOfNanosecondsPerSecond = (1000.0 * 1000.0 * 1000.0) / 100.0;
+
+    // https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms724284(v=vs.85).aspx
+    // "It is not recommended that you add and subtract values from the FILETIME structure to obtain relative times.
+    // Instead, you should copy the low- and high-order parts of the file time to a ULARGE_INTEGER structure,
+    // perform 64-bit arithmetic on the QuadPart member, and copy the LowPart and HighPart members into the FILETIME structure."
+    ULARGE_INTEGER durationIn100NS;
+    memcpy(&durationIn100NS, &fileTime, sizeof(durationIn100NS));
+    return Seconds { durationIn100NS.QuadPart / hundredsOfNanosecondsPerSecond };
+}
+
+std::optional<CPUTime> CPUTime::get()
+{
+    // https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms683223(v=vs.85).aspx
+    FILETIME creationTime;
+    FILETIME exitTime;
+    FILETIME kernelTime;
+    FILETIME userTime;
+    if (!::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime))
+        return std::nullopt;
+
+    return CPUTime { MonotonicTime::now(), fileTimeToSeconds(userTime), fileTimeToSeconds(kernelTime) };
+}
+
+}
index 1c17de6..9f029da 100644 (file)
@@ -2157,7 +2157,6 @@ set(WebCore_SOURCES
     page/scrolling/ScrollingTreeScrollingNode.cpp
     page/scrolling/ThreadedScrollingTree.cpp
 
-    platform/CPUTime.cpp
     platform/CalculationValue.cpp
     platform/Clock.cpp
     platform/ClockGeneric.cpp
index cd29442..72ffca5 100644 (file)
@@ -1,3 +1,27 @@
+2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        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.
+
+        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:
+
 2017-04-28  Per Arne Vollan  <pvollan@apple.com>
 
         Crash under WebCore::AccessibilityRenderObject::handleAriaExpandedChanged().
index 5a183c1..2a39347 100644 (file)
@@ -337,7 +337,6 @@ list(APPEND WebCore_SOURCES
     platform/cf/SharedBufferCF.cpp
     platform/cf/URLCF.cpp
 
-    platform/cocoa/CPUTimeCocoa.mm
     platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
     platform/cocoa/CoreVideoSoftLink.cpp
     platform/cocoa/DisplaySleepDisablerCocoa.cpp
index d93c40d..b97b763 100644 (file)
                460CBF351D4BCD0E0092E88E /* JSDOMWindowProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460CBF331D4BCCFE0092E88E /* JSDOMWindowProperties.cpp */; };
                460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */; };
                4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
-               463763081E26FDD7008CD46D /* CPUTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463763061E26FDBA008CD46D /* CPUTime.cpp */; };
-               463763091E26FDD7008CD46D /* CPUTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 463763071E26FDBA008CD46D /* CPUTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               4637630B1E26FDF6008CD46D /* CPUTimeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4637630A1E26FDEB008CD46D /* CPUTimeCocoa.mm */; };
                463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; };
                463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
                465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; };
                460CBF331D4BCCFE0092E88E /* JSDOMWindowProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowProperties.cpp; sourceTree = "<group>"; };
                460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowProperties.h; sourceTree = "<group>"; };
                4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
-               463763061E26FDBA008CD46D /* CPUTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUTime.cpp; sourceTree = "<group>"; };
-               463763071E26FDBA008CD46D /* CPUTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUTime.h; sourceTree = "<group>"; };
-               4637630A1E26FDEB008CD46D /* CPUTimeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CPUTimeCocoa.mm; sourceTree = "<group>"; };
                463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
                463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
                465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecks.mm; sourceTree = "<group>"; };
                                A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */,
                                CD7D33451C7A16BF00041293 /* CoreVideoSoftLink.cpp */,
                                CD7D33461C7A16BF00041293 /* CoreVideoSoftLink.h */,
-                               4637630A1E26FDEB008CD46D /* CPUTimeCocoa.mm */,
                                7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */,
                                7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */,
                                5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */,
                                862F129D18C1572C005C54AF /* CountedUserActivity.h */,
                                46C696CA1E7205E400597937 /* CPUMonitor.cpp */,
                                46C696C91E7205E400597937 /* CPUMonitor.h */,
-                               463763061E26FDBA008CD46D /* CPUTime.cpp */,
-                               463763071E26FDBA008CD46D /* CPUTime.h */,
                                E11AF15011B9A1A300805103 /* Cursor.cpp */,
                                F587868402DE3B8601EA4122 /* Cursor.h */,
                                A5732B08136A161D005C8D7C /* DateComponents.cpp */,
                                BC5EB9510E82056B00B25965 /* CounterDirectives.h in Headers */,
                                9392F14C0AD1861B00691BD4 /* CounterNode.h in Headers */,
                                46C696CB1E7205F700597937 /* CPUMonitor.h in Headers */,
-                               463763091E26FDD7008CD46D /* CPUTime.h in Headers */,
                                D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */,
                                514C766E0CE923A1007EF3CD /* Credential.h in Headers */,
                                3792917A1985EF3900F4B661 /* CredentialBase.h in Headers */,
                                BC5EB9500E82056B00B25965 /* CounterDirectives.cpp in Sources */,
                                9392F1500AD1862300691BD4 /* CounterNode.cpp in Sources */,
                                46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */,
-                               463763081E26FDD7008CD46D /* CPUTime.cpp in Sources */,
-                               4637630B1E26FDF6008CD46D /* CPUTimeCocoa.mm in Sources */,
                                D0B0556909C6700100307E43 /* CreateLinkCommand.cpp in Sources */,
                                514C766D0CE923A1007EF3CD /* CredentialBase.cpp in Sources */,
                                3792917D1987678F00F4B661 /* CredentialCocoa.mm in Sources */,
                                7C330A071DF9F95100D3395C /* JSPositionOptions.cpp in Sources */,
                                65DF31FF09D1CC60000BE325 /* JSProcessingInstruction.cpp in Sources */,
                                E44613ED0CD681BA00FADA75 /* JSProgressEvent.cpp in Sources */,
-                A578F43B1DE01421003DFC6A /* JSPromiseRejectionEvent.cpp in Sources */,
+                               A578F43B1DE01421003DFC6A /* JSPromiseRejectionEvent.cpp in Sources */,
                                077664FC183E6B5C00133B92 /* JSQuickTimePluginReplacement.cpp in Sources */,
                                B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */,
                                65DF320109D1CC60000BE325 /* JSRange.cpp in Sources */,
index 90aa090..9c63761 100644 (file)
@@ -465,7 +465,7 @@ public:
 
     virtual void didInvalidateDocumentMarkerRects() { }
 
-    virtual void reportProcessCPUTime(int64_t, ActivityStateForCPUSampling) { }
+    virtual void reportProcessCPUTime(Seconds, ActivityStateForCPUSampling) { }
     virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0;
 
     virtual void didChangeClipToSafeArea(bool) { }
index 7b2377d..2e57415 100644 (file)
@@ -76,7 +76,7 @@ PerformanceMonitor::PerformanceMonitor(Page& page)
     ASSERT(!page.isUtilityPage());
 
     if (Settings::isPerActivityStateCPUUsageMeasurementEnabled()) {
-        m_perActivityStateCPUTime = getCPUTime();
+        m_perActivityStateCPUTime = CPUTime::get();
         m_perActivityStateCPUUsageTimer.startRepeating(cpuUsageSamplingInterval);
     }
 }
@@ -174,12 +174,12 @@ void PerformanceMonitor::measurePostLoadCPUUsage()
     }
 
     if (!m_postLoadCPUTime) {
-        m_postLoadCPUTime = getCPUTime();
+        m_postLoadCPUTime = CPUTime::get();
         if (m_postLoadCPUTime)
             m_postPageLoadCPUUsageTimer.startOneShot(postLoadCPUUsageMeasurementDuration);
         return;
     }
-    std::optional<CPUTime> cpuTime = getCPUTime();
+    std::optional<CPUTime> cpuTime = CPUTime::get();
     if (!cpuTime)
         return;
 
@@ -231,12 +231,12 @@ void PerformanceMonitor::measurePostBackgroundingCPUUsage()
     }
 
     if (!m_postBackgroundingCPUTime) {
-        m_postBackgroundingCPUTime = getCPUTime();
+        m_postBackgroundingCPUTime = CPUTime::get();
         if (m_postBackgroundingCPUTime)
             m_postBackgroundingCPUUsageTimer.startOneShot(backgroundCPUUsageMeasurementDuration);
         return;
     }
-    std::optional<CPUTime> cpuTime = getCPUTime();
+    std::optional<CPUTime> cpuTime = CPUTime::get();
     if (!cpuTime)
         return;
 
@@ -274,11 +274,11 @@ void PerformanceMonitor::measureCPUUsageInActivityState(ActivityStateForCPUSampl
     }
 
     if (!m_perActivityStateCPUTime) {
-        m_perActivityStateCPUTime = getCPUTime();
+        m_perActivityStateCPUTime = CPUTime::get();
         return;
     }
 
-    std::optional<CPUTime> cpuTime = getCPUTime();
+    std::optional<CPUTime> cpuTime = CPUTime::get();
     if (!cpuTime) {
         m_perActivityStateCPUTime = std::nullopt;
         return;
index afc2924..6e5e690 100644 (file)
@@ -26,8 +26,8 @@
 #pragma once
 
 #include "ActivityState.h"
-#include "CPUTime.h"
 #include "Timer.h"
+#include <wtf/CPUTime.h>
 #include <wtf/Optional.h>
 
 namespace WebCore {
index 2d3384c..5faaf66 100644 (file)
@@ -43,7 +43,7 @@ void CPUMonitor::setCPULimit(std::optional<double> cpuLimit)
     m_cpuLimit = cpuLimit;
     if (m_cpuLimit) {
         if (!m_timer.isActive()) {
-            m_lastCPUTime = getCPUTime();
+            m_lastCPUTime = CPUTime::get();
             m_timer.startRepeating(m_checkInterval);
         }
     } else
@@ -55,11 +55,11 @@ void CPUMonitor::timerFired()
     ASSERT(m_cpuLimit);
 
     if (!m_lastCPUTime) {
-        m_lastCPUTime = getCPUTime();
+        m_lastCPUTime = CPUTime::get();
         return;
     }
 
-    auto cpuTime = getCPUTime();
+    auto cpuTime = CPUTime::get();
     if (!cpuTime)
         return;
 
index afab6ea..d4ddb77 100644 (file)
@@ -25,9 +25,9 @@
 
 #pragma once
 
-#include "CPUTime.h"
 #include "Timer.h"
 
+#include <wtf/CPUTime.h>
 #include <wtf/Function.h>
 
 namespace WebCore {
index 88ae5d4..7486b39 100644 (file)
@@ -1,3 +1,27 @@
+2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        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.
+
+        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:
+
 2017-04-28  Brady Eidson  <beidson@apple.com>
 
         Teach the DatabaseProcess to be fully SessionID aware
index 0d857bb..b6f0412 100644 (file)
@@ -34,8 +34,6 @@
 
 namespace WebKit {
 
-static const int64_t microsecondsPerSecond = 1000000;
-
 using namespace WebCore;
 
 static const Seconds loggingInterval { 60_min };
@@ -44,7 +42,7 @@ PerActivityStateCPUUsageSampler::PerActivityStateCPUUsageSampler(WebProcessPool&
     : m_processPool(processPool)
     , m_loggingTimer(RunLoop::main(), this, &PerActivityStateCPUUsageSampler::loggingTimerFired)
 {
-    m_lastCPUTime = monotonicallyIncreasingTime();
+    m_lastCPUTime = MonotonicTime::now();
     m_loggingTimer.startRepeating(loggingInterval);
 }
 
@@ -52,7 +50,7 @@ PerActivityStateCPUUsageSampler::~PerActivityStateCPUUsageSampler()
 {
 }
 
-void PerActivityStateCPUUsageSampler::reportWebContentCPUTime(int64_t cpuTime, ActivityStateForCPUSampling activityState)
+void PerActivityStateCPUUsageSampler::reportWebContentCPUTime(Seconds cpuTime, ActivityStateForCPUSampling activityState)
 {
     auto result = m_cpuTimeInActivityState.add(activityState, cpuTime);
     if (!result.isNewEntry)
@@ -79,11 +77,11 @@ void PerActivityStateCPUUsageSampler::loggingTimerFired()
         return;
     }
 
-    double currentCPUTime = monotonicallyIncreasingTime();
-    int64_t cpuTimeDelta = (currentCPUTime - m_lastCPUTime) * microsecondsPerSecond;
+    MonotonicTime currentCPUTime = MonotonicTime::now();
+    Seconds cpuTimeDelta = currentCPUTime - m_lastCPUTime;
 
     for (auto& pair : m_cpuTimeInActivityState) {
-        double cpuUsage = static_cast<double>(pair.value * 100.) / cpuTimeDelta;
+        double cpuUsage = pair.value.value() * 100. / cpuTimeDelta.value();
         String activityStateKey = loggingKeyForActivityState(pair.key);
         page->logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cpuUsageKey(), activityStateKey, cpuUsage, 2, ShouldSample::No);
         RELEASE_LOG(PerformanceLogging, "WebContent processes used %.1f%% CPU in %s state", cpuUsage, activityStateKey.utf8().data());
index dab6f4b..01a7da7 100644 (file)
@@ -39,7 +39,7 @@ public:
     explicit PerActivityStateCPUUsageSampler(WebProcessPool&);
     ~PerActivityStateCPUUsageSampler();
 
-    void reportWebContentCPUTime(int64_t cpuTime, WebCore::ActivityStateForCPUSampling);
+    void reportWebContentCPUTime(Seconds cpuTime, WebCore::ActivityStateForCPUSampling);
 
 private:
     void loggingTimerFired();
@@ -47,9 +47,9 @@ private:
 
     WebProcessPool& m_processPool;
     RunLoop::Timer<PerActivityStateCPUUsageSampler> m_loggingTimer;
-    typedef HashMap<WebCore::ActivityStateForCPUSampling, int64_t, WTF::IntHash<WebCore::ActivityStateForCPUSampling>, WTF::StrongEnumHashTraits<WebCore::ActivityStateForCPUSampling>> CPUTimeInActivityStateMap;
+    typedef HashMap<WebCore::ActivityStateForCPUSampling, Seconds, WTF::IntHash<WebCore::ActivityStateForCPUSampling>, WTF::StrongEnumHashTraits<WebCore::ActivityStateForCPUSampling>> CPUTimeInActivityStateMap;
     CPUTimeInActivityStateMap m_cpuTimeInActivityState;
-    double m_lastCPUTime;
+    MonotonicTime m_lastCPUTime;
 };
 
 } // namespace WebKit
index 8992860..36c64e4 100644 (file)
@@ -1618,7 +1618,7 @@ void WebProcessPool::updateHiddenPageThrottlingAutoIncreaseLimit()
     sendToAllProcesses(Messages::WebProcess::SetHiddenPageDOMTimerThrottlingIncreaseLimit(limitInMilliseconds));
 }
 
-void WebProcessPool::reportWebContentCPUTime(int64_t cpuTime, uint64_t activityState)
+void WebProcessPool::reportWebContentCPUTime(Seconds cpuTime, uint64_t activityState)
 {
 #if PLATFORM(MAC)
     if (m_perActivityStateCPUUsageSampler)
index c9c8d56..f3ea684 100644 (file)
@@ -264,7 +264,7 @@ public:
     void terminateDatabaseProcess();
     void terminateNetworkProcess();
 
-    void reportWebContentCPUTime(int64_t cpuTime, uint64_t activityState);
+    void reportWebContentCPUTime(Seconds cpuTime, uint64_t activityState);
 
     void allowSpecificHTTPSCertificateForHost(const WebCertificateInfo*, const String& host);
 
index 8990c00..e0bb269 100644 (file)
@@ -35,5 +35,5 @@ messages -> WebProcessPool {
     void AddPlugInAutoStartOriginHash(String pageOrigin, uint32_t hash, WebCore::SessionID sessionID)
     void PlugInDidReceiveUserInteraction(uint32_t hash, WebCore::SessionID sessionID)
 
-    ReportWebContentCPUTime(int64_t cpuTime, uint64_t activityState)
+    ReportWebContentCPUTime(Seconds cpuTime, uint64_t activityState)
 }
index 80fe6ae..96a78f5 100644 (file)
@@ -276,7 +276,7 @@ void WebChromeClient::runModal()
     m_page.runModal();
 }
 
-void WebChromeClient::reportProcessCPUTime(int64_t cpuTime, ActivityStateForCPUSampling activityState)
+void WebChromeClient::reportProcessCPUTime(Seconds cpuTime, ActivityStateForCPUSampling activityState)
 {
     WebProcess::singleton().send(Messages::WebProcessPool::ReportWebContentCPUTime(cpuTime, static_cast<uint64_t>(activityState)), 0);
 }
index 1c4d6bb..cb08558 100644 (file)
@@ -68,7 +68,7 @@ private:
     bool canRunModal() final;
     void runModal() final;
 
-    void reportProcessCPUTime(int64_t, WebCore::ActivityStateForCPUSampling) final;
+    void reportProcessCPUTime(Seconds, WebCore::ActivityStateForCPUSampling) final;
     
     void setToolbarsVisible(bool) final;
     bool toolbarsVisible() final;