mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 14:01:17 +12:00
Cleanup
This commit is contained in:
parent
feefdf5fc4
commit
002acbd7a0
2 changed files with 20 additions and 20 deletions
|
@ -13,6 +13,18 @@ uint32_t GetProcessorCount()
|
||||||
return std::thread::hardware_concurrency();
|
return std::thread::hardware_concurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t QueryRamUsage()
|
||||||
|
{
|
||||||
|
long page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
|
||||||
|
std::ifstream file("/proc/self/statm");
|
||||||
|
file.ignore(std::numeric_limits<std::streamsize>::max(), ' ');
|
||||||
|
uint64_t no_pages;
|
||||||
|
file >> no_pages;
|
||||||
|
|
||||||
|
return no_pages * page_size;
|
||||||
|
}
|
||||||
|
|
||||||
void QueryProcTime(uint64_t &out_now, uint64_t &out_user, uint64_t &out_kernel)
|
void QueryProcTime(uint64_t &out_now, uint64_t &out_user, uint64_t &out_kernel)
|
||||||
{
|
{
|
||||||
struct tms time_info;
|
struct tms time_info;
|
||||||
|
@ -42,16 +54,4 @@ void QueryCoreTimes(uint32_t count, ProcessorTime out[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t QueryRamUsage()
|
|
||||||
{
|
|
||||||
long page_size = sysconf(_SC_PAGESIZE);
|
|
||||||
|
|
||||||
std::ifstream file("/proc/self/statm");
|
|
||||||
file.ignore(std::numeric_limits<std::streamsize>::max(), ' ');
|
|
||||||
uint64_t no_pages;
|
|
||||||
file >> no_pages;
|
|
||||||
|
|
||||||
return no_pages * page_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -13,6 +13,14 @@ uint32_t GetProcessorCount()
|
||||||
return sys_info.dwNumberOfProcessors;
|
return sys_info.dwNumberOfProcessors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t QueryRamUsage()
|
||||||
|
{
|
||||||
|
PROCESS_MEMORY_COUNTERS pmc{};
|
||||||
|
pmc.cb = sizeof(pmc);
|
||||||
|
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
|
||||||
|
return pmc.WorkingSetSize;
|
||||||
|
}
|
||||||
|
|
||||||
void QueryProcTime(uint64_t &out_now, uint64_t &out_user, uint64_t &out_kernel)
|
void QueryProcTime(uint64_t &out_now, uint64_t &out_user, uint64_t &out_kernel)
|
||||||
{
|
{
|
||||||
FILETIME ftime, fkernel, fuser;
|
FILETIME ftime, fkernel, fuser;
|
||||||
|
@ -47,12 +55,4 @@ void QueryCoreTimes(uint32_t count, ProcessorTime out[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t QueryRamUsage()
|
|
||||||
{
|
|
||||||
PROCESS_MEMORY_COUNTERS pmc{};
|
|
||||||
pmc.cb = sizeof(pmc);
|
|
||||||
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
|
|
||||||
return pmc.WorkingSetSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue