From 06665734e730af765baa9b056d1fe665692a5b96 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 4 Mar 2025 22:57:58 +0100 Subject: [PATCH] Fix `Platform::GetCacheLineSize` to be deprecated in favor of `CPUInfo` --- Source/Engine/Platform/Android/AndroidPlatform.cpp | 5 ----- Source/Engine/Platform/Android/AndroidPlatform.h | 1 - Source/Engine/Platform/Apple/ApplePlatform.cpp | 5 ----- Source/Engine/Platform/Apple/ApplePlatform.h | 1 - Source/Engine/Platform/Base/PlatformBase.cpp | 5 +++++ Source/Engine/Platform/Base/PlatformBase.h | 3 ++- Source/Engine/Platform/Linux/LinuxPlatform.cpp | 5 ----- Source/Engine/Platform/Linux/LinuxPlatform.h | 1 - Source/Engine/Platform/Win32/Win32Platform.cpp | 5 ----- Source/Engine/Platform/Win32/Win32Platform.h | 1 - 10 files changed, 7 insertions(+), 25 deletions(-) diff --git a/Source/Engine/Platform/Android/AndroidPlatform.cpp b/Source/Engine/Platform/Android/AndroidPlatform.cpp index c4ef0379c..591943890 100644 --- a/Source/Engine/Platform/Android/AndroidPlatform.cpp +++ b/Source/Engine/Platform/Android/AndroidPlatform.cpp @@ -709,11 +709,6 @@ CPUInfo AndroidPlatform::GetCPUInfo() return AndroidCpu; } -int32 AndroidPlatform::GetCacheLineSize() -{ - return AndroidCpu.CacheLineSize; -} - MemoryStats AndroidPlatform::GetMemoryStats() { const uint64 pageSize = getpagesize(); diff --git a/Source/Engine/Platform/Android/AndroidPlatform.h b/Source/Engine/Platform/Android/AndroidPlatform.h index 4d8955627..c300a0f2a 100644 --- a/Source/Engine/Platform/Android/AndroidPlatform.h +++ b/Source/Engine/Platform/Android/AndroidPlatform.h @@ -81,7 +81,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID() diff --git a/Source/Engine/Platform/Apple/ApplePlatform.cpp b/Source/Engine/Platform/Apple/ApplePlatform.cpp index 4844c41aa..6d9b19296 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.cpp +++ b/Source/Engine/Platform/Apple/ApplePlatform.cpp @@ -134,11 +134,6 @@ CPUInfo ApplePlatform::GetCPUInfo() return Cpu; } -int32 ApplePlatform::GetCacheLineSize() -{ - return Cpu.CacheLineSize; -} - MemoryStats ApplePlatform::GetMemoryStats() { MemoryStats result; diff --git a/Source/Engine/Platform/Apple/ApplePlatform.h b/Source/Engine/Platform/Apple/ApplePlatform.h index 9f0fddebf..6f16c07e8 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.h +++ b/Source/Engine/Platform/Apple/ApplePlatform.h @@ -67,7 +67,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID(); diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 6efa3c8b4..93560b1e8 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -257,6 +257,11 @@ bool PlatformBase::Is64BitApp() #endif } +int32 PlatformBase::GetCacheLineSize() +{ + return (int32)Platform::GetCPUInfo().CacheLineSize; +} + void PlatformBase::Fatal(const Char* msg, void* context) { // Check if is already during fatal state diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index d5ff4c59f..e1049af70 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -357,9 +357,10 @@ public: /// /// Gets the CPU cache line size. + /// [Deprecated in v1.10] /// /// The cache line size. - API_PROPERTY() static int32 GetCacheLineSize() = delete; + API_PROPERTY() DEPRECATED("Use CacheLineSize field from CPUInfo.") static int32 GetCacheLineSize(); /// /// Gets the current memory stats. diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.cpp b/Source/Engine/Platform/Linux/LinuxPlatform.cpp index 2c951effa..c017a8040 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.cpp +++ b/Source/Engine/Platform/Linux/LinuxPlatform.cpp @@ -1766,11 +1766,6 @@ CPUInfo LinuxPlatform::GetCPUInfo() return UnixCpu; } -int32 LinuxPlatform::GetCacheLineSize() -{ - return UnixCpu.CacheLineSize; -} - MemoryStats LinuxPlatform::GetMemoryStats() { // Get memory usage diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.h b/Source/Engine/Platform/Linux/LinuxPlatform.h index 10c81f436..864e27812 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.h +++ b/Source/Engine/Platform/Linux/LinuxPlatform.h @@ -95,7 +95,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID() diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index a9aa784c2..8525221b2 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -304,11 +304,6 @@ CPUInfo Win32Platform::GetCPUInfo() return CpuInfo; } -int32 Win32Platform::GetCacheLineSize() -{ - return CpuInfo.CacheLineSize; -} - MemoryStats Win32Platform::GetMemoryStats() { // Get memory stats diff --git a/Source/Engine/Platform/Win32/Win32Platform.h b/Source/Engine/Platform/Win32/Win32Platform.h index 5d020a0fd..70b44876f 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.h +++ b/Source/Engine/Platform/Win32/Win32Platform.h @@ -90,7 +90,6 @@ public: static void FreePages(void* ptr); static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentProcessId();