mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-09 08:21:18 +12:00
Clean return value if any win32 call fails.
This commit is contained in:
parent
e3ea4c5046
commit
369ae1d28a
1 changed files with 24 additions and 10 deletions
|
@ -10,8 +10,14 @@ uint64 QueryRamUsage()
|
||||||
{
|
{
|
||||||
PROCESS_MEMORY_COUNTERS pmc{};
|
PROCESS_MEMORY_COUNTERS pmc{};
|
||||||
pmc.cb = sizeof(pmc);
|
pmc.cb = sizeof(pmc);
|
||||||
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
|
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
|
||||||
return pmc.WorkingSetSize;
|
{
|
||||||
|
return pmc.WorkingSetSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
||||||
|
@ -22,16 +28,24 @@ void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
||||||
now.LowPart = ftime.dwLowDateTime;
|
now.LowPart = ftime.dwLowDateTime;
|
||||||
now.HighPart = ftime.dwHighDateTime;
|
now.HighPart = ftime.dwHighDateTime;
|
||||||
|
|
||||||
GetProcessTimes(GetCurrentProcess(), &ftime, &ftime, &fkernel, &fuser);
|
if (GetProcessTimes(GetCurrentProcess(), &ftime, &ftime, &fkernel, &fuser))
|
||||||
kernel.LowPart = fkernel.dwLowDateTime;
|
{
|
||||||
kernel.HighPart = fkernel.dwHighDateTime;
|
kernel.LowPart = fkernel.dwLowDateTime;
|
||||||
|
kernel.HighPart = fkernel.dwHighDateTime;
|
||||||
|
|
||||||
user.LowPart = fuser.dwLowDateTime;
|
user.LowPart = fuser.dwLowDateTime;
|
||||||
user.HighPart = fuser.dwHighDateTime;
|
user.HighPart = fuser.dwHighDateTime;
|
||||||
|
|
||||||
out_now = now.QuadPart;
|
out_now = now.QuadPart;
|
||||||
out_user = user.QuadPart;
|
out_user = user.QuadPart;
|
||||||
out_kernel = kernel.QuadPart;
|
out_kernel = kernel.QuadPart;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out_now = 0;
|
||||||
|
out_user = 0;
|
||||||
|
out_kernel = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryCoreTimes(uint32 count, ProcessorTime out[])
|
void QueryCoreTimes(uint32 count, ProcessorTime out[])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue