Title: [272697] trunk
Revision
272697
Author
chris.r...@sony.com
Date
2021-02-10 16:11:34 -0800 (Wed, 10 Feb 2021)

Log Message

[PlayStation] Add initial RESOURCE_USAGE implementation
https://bugs.webkit.org/show_bug.cgi?id=221706

Reviewed by Ross Kirsling.

.:

* Source/cmake/OptionsPlayStation.cmake:

Source/WebCore:

Add initial RESOURCE_USAGE data for the inspector.
CPU usage and total memory information is just stubbed out for now.

* PlatformPlayStation.cmake:
* page/playstation/ResourceUsageOverlayPlayStation.cpp: Added.
* page/playstation/ResourceUsageThreadPlayStation.cpp: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (272696 => 272697)


--- trunk/ChangeLog	2021-02-11 00:07:25 UTC (rev 272696)
+++ trunk/ChangeLog	2021-02-11 00:11:34 UTC (rev 272697)
@@ -1,3 +1,12 @@
+2021-02-10  Christopher Reid  <chris.r...@sony.com>
+
+        [PlayStation] Add initial RESOURCE_USAGE implementation
+        https://bugs.webkit.org/show_bug.cgi?id=221706
+
+        Reviewed by Ross Kirsling.
+
+        * Source/cmake/OptionsPlayStation.cmake:
+
 2021-02-10  Philippe Normand  <pnorm...@igalia.com>
 
         [WPE] Optionally build Cog as external project and replacement for MiniBrowser

Modified: trunk/Source/WebCore/ChangeLog (272696 => 272697)


--- trunk/Source/WebCore/ChangeLog	2021-02-11 00:07:25 UTC (rev 272696)
+++ trunk/Source/WebCore/ChangeLog	2021-02-11 00:11:34 UTC (rev 272697)
@@ -1,3 +1,17 @@
+2021-02-10  Christopher Reid  <chris.r...@sony.com>
+
+        [PlayStation] Add initial RESOURCE_USAGE implementation
+        https://bugs.webkit.org/show_bug.cgi?id=221706
+
+        Reviewed by Ross Kirsling.
+
+        Add initial RESOURCE_USAGE data for the inspector.
+        CPU usage and total memory information is just stubbed out for now.
+
+        * PlatformPlayStation.cmake:
+        * page/playstation/ResourceUsageOverlayPlayStation.cpp: Added.
+        * page/playstation/ResourceUsageThreadPlayStation.cpp: Added.
+
 2021-02-10  Peng Liu  <peng.l...@apple.com>
 
         Remove MediaSourcePrivateClient::monitorSourceBuffers()

Modified: trunk/Source/WebCore/PlatformPlayStation.cmake (272696 => 272697)


--- trunk/Source/WebCore/PlatformPlayStation.cmake	2021-02-11 00:07:25 UTC (rev 272696)
+++ trunk/Source/WebCore/PlatformPlayStation.cmake	2021-02-11 00:11:34 UTC (rev 272697)
@@ -17,6 +17,9 @@
 list(APPEND WebCore_SOURCES
     editing/libwpe/EditorLibWPE.cpp
 
+    page/playstation/ResourceUsageOverlayPlayStation.cpp
+    page/playstation/ResourceUsageThreadPlayStation.cpp
+
     page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp
     page/scrolling/nicosia/ScrollingStateNodeNicosia.cpp
     page/scrolling/nicosia/ScrollingTreeFixedNode.cpp

Added: trunk/Source/WebCore/page/playstation/ResourceUsageOverlayPlayStation.cpp (0 => 272697)


--- trunk/Source/WebCore/page/playstation/ResourceUsageOverlayPlayStation.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/playstation/ResourceUsageOverlayPlayStation.cpp	2021-02-11 00:11:34 UTC (rev 272697)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * 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 "ResourceUsageOverlay.h"
+
+#if ENABLE(RESOURCE_USAGE)
+
+namespace WebCore {
+
+void ResourceUsageOverlay::platformInitialize()
+{
+}
+
+void ResourceUsageOverlay::platformDestroy()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(RESOURCE_USAGE)

Added: trunk/Source/WebCore/page/playstation/ResourceUsageThreadPlayStation.cpp (0 => 272697)


--- trunk/Source/WebCore/page/playstation/ResourceUsageThreadPlayStation.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/playstation/ResourceUsageThreadPlayStation.cpp	2021-02-11 00:11:34 UTC (rev 272697)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * 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 "ResourceUsageThread.h"
+
+#if ENABLE(RESOURCE_USAGE)
+
+#include <_javascript_Core/GCActivityCallback.h>
+#include <_javascript_Core/VM.h>
+
+namespace WebCore {
+
+static float cpuUsage()
+{
+    // FIXME: Need a way to calculate cpu usage
+    return 0;
+}
+
+void ResourceUsageThread::platformSaveStateBeforeStarting()
+{
+}
+
+void ResourceUsageThread::platformCollectCPUData(JSC::VM*, ResourceUsageData& data)
+{
+    data.cpu = cpuUsage();
+
+    // FIXME: Exclude the ResourceUsage thread.
+    // FIXME: Exclude the SamplingProfiler thread.
+    // FIXME: Classify usage per thread.
+    data.cpuExcludingDebuggerThreads = data.cpu;
+}
+
+void ResourceUsageThread::platformCollectMemoryData(JSC::VM* vm, ResourceUsageData& data)
+{
+    // FIXME: Calculate total dirty memory size for ResourceUsageOverlay
+    data.totalDirtySize = 0;
+
+    size_t currentGCHeapCapacity = vm->heap.blockBytesAllocated();
+    size_t currentGCOwnedExtra = vm->heap.extraMemorySize();
+    size_t currentGCOwnedExternal = vm->heap.externalMemorySize();
+    RELEASE_ASSERT(currentGCOwnedExternal <= currentGCOwnedExtra);
+
+    data.categories[MemoryCategory::GCHeap].dirtySize = currentGCHeapCapacity;
+    data.categories[MemoryCategory::GCOwned].dirtySize = currentGCOwnedExtra - currentGCOwnedExternal;
+    data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
+
+    data.totalExternalSize = currentGCOwnedExternal;
+
+    data.timeOfNextEdenCollection = data.timestamp + vm->heap.edenActivityCallback()->timeUntilFire().valueOr(Seconds(std::numeric_limits<double>::infinity()));
+    data.timeOfNextFullCollection = data.timestamp + vm->heap.fullActivityCallback()->timeUntilFire().valueOr(Seconds(std::numeric_limits<double>::infinity()));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(RESOURCE_USAGE)

Modified: trunk/Source/cmake/OptionsPlayStation.cmake (272696 => 272697)


--- trunk/Source/cmake/OptionsPlayStation.cmake	2021-02-11 00:07:25 UTC (rev 272696)
+++ trunk/Source/cmake/OptionsPlayStation.cmake	2021-02-11 00:11:34 UTC (rev 272697)
@@ -37,6 +37,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PERIODIC_MEMORY_MONITOR PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_LOAD_STATISTICS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
 
 # Experimental features
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_APPLICATION_MANIFEST PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to