mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-05 06:21:19 +12:00
Added process cpu use and per-core global cpu use to linux overlay.
This commit is contained in:
parent
5f484b22d2
commit
2d30edcbc6
5 changed files with 181 additions and 79 deletions
29
src/util/ProcessorTime/ProcessorTime.cpp
Normal file
29
src/util/ProcessorTime/ProcessorTime.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "util/ProcessorTime/ProcessorTime.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