mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 04:38:49 +00:00
Merge pull request #5583 from shuffle2/remove-psapi
remove MemUsage, and therefor psapi dependency
This commit is contained in:
commit
1f30bd1f26
5 changed files with 4 additions and 31 deletions
|
@ -14,7 +14,6 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include "Common/StringUtil.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue