mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 22:11:18 +12:00
Refactor ProcessorTime to SystemInfo
This commit is contained in:
parent
002acbd7a0
commit
4aaefeaefd
5 changed files with 5 additions and 5 deletions
29
src/util/SystemInfo/SystemInfo.cpp
Normal file
29
src/util/SystemInfo/SystemInfo.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "util/SystemInfo/SystemInfo.h"
|
||||
|
||||
uint64_t ProcessorTime::work()
|
||||
{
|
||||
return user + kernel;
|
||||
}
|
||||
|
||||
uint64_t 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;
|
||||
}
|
||||
|
||||
void QueryProcTime(ProcessorTime &out)
|
||||
{
|
||||
uint64_t now, user, kernel;
|
||||
QueryProcTime(now, user, kernel);
|
||||
|
||||
out.idle = now - (user + kernel);
|
||||
out.kernel = kernel;
|
||||
out.user = user;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue