FreeBSD: improve actual processor calculation logic

This commit is contained in:
Alexander Nedotsukov 2021-03-30 10:58:09 +03:00 committed by cgzones
parent 73f5ecf528
commit 5afb57b49e
1 changed files with 5 additions and 1 deletions

View File

@ -572,7 +572,11 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
proc->percent_cpu = 100.0 * ((double)kproc->ki_pctcpu / (double)kernelFScale); proc->percent_cpu = 100.0 * ((double)kproc->ki_pctcpu / (double)kernelFScale);
proc->percent_mem = 100.0 * proc->m_resident / (double)(super->totalMem); proc->percent_mem = 100.0 * proc->m_resident / (double)(super->totalMem);
if (kproc->ki_stat == SRUN && kproc->ki_oncpu != NOCPU) {
proc->processor = kproc->ki_oncpu;
} else {
proc->processor = kproc->ki_lastcpu; proc->processor = kproc->ki_lastcpu;
}
proc->majflt = kproc->ki_cow; proc->majflt = kproc->ki_cow;