|
|
|
|
@ -86,7 +86,6 @@ static int MIB_kern_cp_time[2]; |
|
|
|
|
static int MIB_kern_cp_times[2]; |
|
|
|
|
static int kernelFScale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { |
|
|
|
|
size_t len; |
|
|
|
|
char errbuf[_POSIX2_LINE_MAX]; |
|
|
|
|
@ -483,6 +482,7 @@ void ProcessList_goThroughEntries(ProcessList* this) { |
|
|
|
|
// from FreeBSD source /src/usr.bin/top/machine.c
|
|
|
|
|
proc->m_size = kproc->ki_size / 1024 / pageSizeKb; |
|
|
|
|
proc->m_resident = kproc->ki_rssize; |
|
|
|
|
proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(this->totalMem) * 100.0; |
|
|
|
|
proc->nlwp = kproc->ki_numthreads; |
|
|
|
|
proc->time = (kproc->ki_runtime + 5000) / 10000; |
|
|
|
|
|
|
|
|
|
@ -493,9 +493,6 @@ void ProcessList_goThroughEntries(ProcessList* this) { |
|
|
|
|
// system idle process should own all CPU time left regardless of CPU count
|
|
|
|
|
if ( strcmp("idle", kproc->ki_comm) == 0 ) { |
|
|
|
|
isIdleProcess = true; |
|
|
|
|
} else { |
|
|
|
|
if (cpus > 1) |
|
|
|
|
proc->percent_cpu = proc->percent_cpu / (double) cpus; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (isIdleProcess == false && proc->percent_cpu >= 99.8) { |
|
|
|
|
|