mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Fix CPU percentage. Patch 3522180 for bug 3516978, by Richard.
This commit is contained in:
parent
05a78c8111
commit
90d567531a
@ -677,7 +677,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
|
||||
unsigned long long int lasttimes = (process->utime + process->stime);
|
||||
if (! ProcessList_readStatFile(process, dirname, name, command))
|
||||
goto errorReadingProcess;
|
||||
int percent_cpu = (process->utime + process->stime - lasttimes) / period * 100.0;
|
||||
float percent_cpu = (process->utime + process->stime - lasttimes) / period * 100.0;
|
||||
process->percent_cpu = MAX(MIN(percent_cpu, cpus*100.0), 0.0);
|
||||
if (isnan(process->percent_cpu)) process->percent_cpu = 0.0;
|
||||
process->percent_mem = (process->m_resident * PAGE_SIZE_KB) / (double)(this->totalMem) * 100.0;
|
||||
|
Loading…
Reference in New Issue
Block a user