Merge pull request #5583 from shuffle2/remove-psapi
remove MemUsage, and therefor psapi dependency
This commit is contained in:
commit
1f30bd1f26
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -176,31 +175,6 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||||
PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str());
|
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()
|
size_t MemPhysical()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -17,7 +17,6 @@ void FreeAlignedMemory(void* ptr);
|
||||||
void ReadProtectMemory(void* ptr, size_t size);
|
void ReadProtectMemory(void* ptr, size_t size);
|
||||||
void WriteProtectMemory(void* ptr, size_t size, bool executable = false);
|
void WriteProtectMemory(void* ptr, size_t size, bool executable = false);
|
||||||
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
|
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
|
||||||
std::string MemUsage();
|
|
||||||
size_t MemPhysical();
|
size_t MemPhysical();
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
@ -155,8 +155,8 @@ void FrameUpdateOnCPUThread()
|
||||||
// Formatted stop message
|
// Formatted stop message
|
||||||
std::string StopMessage(bool main_thread, const std::string& 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",
|
return StringFromFormat("Stop [%s %i]\t%s", main_thread ? "Main Thread" : "Video Thread",
|
||||||
Common::CurrentThreadId(), Common::MemUsage().c_str(), message.c_str());
|
Common::CurrentThreadId(), message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMessage(const std::string& message, int time_in_ms)
|
void DisplayMessage(const std::string& message, int time_in_ms)
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<PreprocessorDefinitions>HAVE_FFMPEG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>HAVE_FFMPEG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>USE_UPNP;USE_USBDK;__LIBUSB__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_UPNP;USE_USBDK;__LIBUSB__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>PSAPI_VERSION=1;_M_X86=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_M_X86=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>SFML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>USE_ANALYTICS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>USE_ANALYTICS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<!--Compile files needed to MOC and output in the build directory-->
|
<!--Compile files needed to MOC and output in the build directory-->
|
||||||
<!--TODO find a way to autocreate from ClCompile settings-->
|
<!--TODO find a way to autocreate from ClCompile settings-->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MocDefines>-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</MocDefines>
|
<MocDefines>-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</MocDefines>
|
||||||
<MocDefines Condition="'$(Configuration)'=='Release'">-DQT_NO_DEBUG -DNDEBUG $(MocDefines)</MocDefines>
|
<MocDefines Condition="'$(Configuration)'=='Release'">-DQT_NO_DEBUG -DNDEBUG $(MocDefines)</MocDefines>
|
||||||
<!-- !!!HOLY UGLY BATMAN!!!
|
<!-- !!!HOLY UGLY BATMAN!!!
|
||||||
Be very careful here when adding include directories. Each path must have the whole arg surrounded by doublequotes - HOWEVER,
|
Be very careful here when adding include directories. Each path must have the whole arg surrounded by doublequotes - HOWEVER,
|
||||||
|
|
Loading…
Reference in New Issue