summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2016-03-07 16:58:47 -0300
committerHisham Muhammad <hisham@gobolinux.org>2016-03-07 16:58:47 -0300
commit453105e77a961f0c4fc075c29d579ed5585e949c (patch)
treee50f557bbf86a25fe49bd1d79c9f1d48b4242ab1
parent694addceb5a36952d131e948c7d0a56c89a63591 (diff)
parentdb80f202f2b264ecbc979661c48204ec97a849af (diff)
Merge branch 'Sp1l-master'
-rw-r--r--freebsd/FreeBSDProcessList.c5
-rw-r--r--freebsd/FreeBSDProcessList.h1
-rw-r--r--freebsd/Platform.c10
3 files changed, 6 insertions, 10 deletions
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index 0cfe16c3..241bee23 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -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) {
diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h
index 2267379e..af343fb0 100644
--- a/freebsd/FreeBSDProcessList.h
+++ b/freebsd/FreeBSDProcessList.h
@@ -55,7 +55,6 @@ typedef struct FreeBSDProcessList_ {
-
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
index f02daa5a..4185a8b5 100644
--- a/freebsd/Platform.c
+++ b/freebsd/Platform.c
@@ -163,15 +163,15 @@ double Platform_setCPUValues(Meter* this, int cpu) {
double percent;
double* v = this->values;
- v[CPU_METER_NICE] = cpuData->nicePercent;
- v[CPU_METER_NORMAL] = cpuData->userPercent;
+ v[CPU_METER_NICE] = cpuData->nicePercent * cpus;
+ v[CPU_METER_NORMAL] = cpuData->userPercent * cpus;
if (this->pl->settings->detailedCPUTime) {
- v[CPU_METER_KERNEL] = cpuData->systemPercent;
- v[CPU_METER_IRQ] = cpuData->irqPercent;
+ v[CPU_METER_KERNEL] = cpuData->systemPercent * cpus;
+ v[CPU_METER_IRQ] = cpuData->irqPercent * cpus;
Meter_setItems(this, 4);
percent = v[0]+v[1]+v[2]+v[3];
} else {
- v[2] = cpuData->systemAllPercent;
+ v[2] = cpuData->systemAllPercent * cpus;
Meter_setItems(this, 3);
percent = v[0]+v[1]+v[2];
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy