mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-02 05:54:18 +01:00
34 lines
612 B
C++
34 lines
612 B
C++
#include "util/SystemInfo/SystemInfo.h"
|
|
|
|
uint64 ProcessorTime::work()
|
|
{
|
|
return user + kernel;
|
|
}
|
|
|
|
uint64 ProcessorTime::total()
|
|
{
|
|
return idle + user + kernel;
|
|
}
|
|
|
|
double ProcessorTime::Compare(ProcessorTime &last, ProcessorTime &now)
|
|
{
|
|
auto dwork = now.work() - last.work();
|
|
auto dtotal = now.total() - last.total();
|
|
|
|
return (double)dwork / dtotal;
|
|
}
|
|
|
|
uint32 GetProcessorCount()
|
|
{
|
|
return std::thread::hardware_concurrency();
|
|
}
|
|
|
|
void QueryProcTime(ProcessorTime &out)
|
|
{
|
|
uint64 now, user, kernel;
|
|
QueryProcTime(now, user, kernel);
|
|
|
|
out.idle = now - (user + kernel);
|
|
out.kernel = kernel;
|
|
out.user = user;
|
|
} |