From f206a4ea9c7e28d09676e1d29a4c32942c323cb6 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 8 Jun 2017 22:25:46 -0700 Subject: [PATCH] remove MemUsage, and therefor psapi dependency --- Source/Core/Common/MemoryUtil.cpp | 26 -------------------------- Source/Core/Common/MemoryUtil.h | 1 - Source/Core/Core/Core.cpp | 4 ++-- Source/VSProps/Base.props | 2 +- Source/VSProps/QtCompile.props | 2 +- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp index 305d779c3f..beb594302e 100644 --- a/Source/Core/Common/MemoryUtil.cpp +++ b/Source/Core/Common/MemoryUtil.cpp @@ -14,7 +14,6 @@ #ifdef _WIN32 #include -#include #include "Common/StringUtil.h" #else #include @@ -176,31 +175,6 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); } -std::string MemUsage() -{ -#ifdef _WIN32 -#pragma comment(lib, "psapi") - DWORD processID = GetCurrentProcessId(); - HANDLE hProcess; - PROCESS_MEMORY_COUNTERS pmc; - std::string Ret; - - // Print information about the memory usage of the process. - - hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - if (nullptr == hProcess) - return "MemUsage Error"; - - if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) - Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); - - CloseHandle(hProcess); - return Ret; -#else - return ""; -#endif -} - size_t MemPhysical() { #ifdef _WIN32 diff --git a/Source/Core/Common/MemoryUtil.h b/Source/Core/Common/MemoryUtil.h index 96709174dd..72eb4f68f9 100644 --- a/Source/Core/Common/MemoryUtil.h +++ b/Source/Core/Common/MemoryUtil.h @@ -17,7 +17,6 @@ void FreeAlignedMemory(void* ptr); void ReadProtectMemory(void* ptr, size_t size); void WriteProtectMemory(void* ptr, size_t size, bool executable = false); void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false); -std::string MemUsage(); size_t MemPhysical(); } // namespace Common diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 5c2be41259..760d16d95d 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -155,8 +155,8 @@ void FrameUpdateOnCPUThread() // Formatted stop message std::string StopMessage(bool main_thread, const std::string& message) { - return StringFromFormat("Stop [%s %i]\t%s\t%s", main_thread ? "Main Thread" : "Video Thread", - Common::CurrentThreadId(), Common::MemUsage().c_str(), message.c_str()); + return StringFromFormat("Stop [%s %i]\t%s", main_thread ? "Main Thread" : "Video Thread", + Common::CurrentThreadId(), message.c_str()); } void DisplayMessage(const std::string& message, int time_in_ms) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 300dbda26b..77ad7ca338 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -56,7 +56,7 @@ HAVE_FFMPEG;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) USE_UPNP;USE_USBDK;__LIBUSB__;%(PreprocessorDefinitions) - PSAPI_VERSION=1;_M_X86=1;%(PreprocessorDefinitions) + _M_X86=1;%(PreprocessorDefinitions) SFML_STATIC;%(PreprocessorDefinitions) USE_ANALYTICS=1;%(PreprocessorDefinitions) CURL_STATICLIB;%(PreprocessorDefinitions) diff --git a/Source/VSProps/QtCompile.props b/Source/VSProps/QtCompile.props index 63e414a148..25ccf977a9 100644 --- a/Source/VSProps/QtCompile.props +++ b/Source/VSProps/QtCompile.props @@ -45,7 +45,7 @@ - -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_SECURE_SCL=0 -D_ARCH_64=1 -D_M_X86_64=1 -DPSAPI_VERSION=1 -D_M_X86=1 -DUSE_UPNP -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_UNICODE -DUNICODE + -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_SECURE_SCL=0 -D_ARCH_64=1 -D_M_X86_64=1 -D_M_X86=1 -DUSE_UPNP -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_UNICODE -DUNICODE -DQT_NO_DEBUG -DNDEBUG $(MocDefines)