aboutsummaryrefslogtreecommitdiff
path: root/sysutils/htop/files
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2016-02-14 03:07:00 +0000
committerCy Schubert <cy@FreeBSD.org>2016-02-14 03:07:00 +0000
commitece5a55f16e5cb224eb5c811efbdbe3e5db2b01c (patch)
tree63ace72e26f8b43b5badbdb89639aeeff08b9c16 /sysutils/htop/files
parentd5cb36ef781adde6358ea6885409d0df43fda208 (diff)
downloadports-ece5a55f16e5cb224eb5c811efbdbe3e5db2b01c.tar.gz
ports-ece5a55f16e5cb224eb5c811efbdbe3e5db2b01c.zip
Notes
Diffstat (limited to 'sysutils/htop/files')
-rw-r--r--sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c b/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c
index 27f7165ab4b1..af92b315bbda 100644
--- a/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c
+++ b/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c
@@ -1,6 +1,24 @@
---- freebsd/FreeBSDProcessList.c.orig 2016-02-13 00:37:56.160832000 +0800
-+++ freebsd/FreeBSDProcessList.c 2016-02-13 00:38:19.671290000 +0800
-@@ -477,8 +477,8 @@
+--- freebsd/FreeBSDProcessList.c.orig 2016-02-10 12:48:39.000000000 -0800
++++ freebsd/FreeBSDProcessList.c 2016-02-13 13:42:40.759431578 -0800
+@@ -84,6 +84,8 @@
+ static int MIB_kern_cp_times[2];
+ static int kernelFScale;
+
++// XXX hack
++static unsigned long long int Global_totalMem;
+
+ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) {
+ FreeBSDProcessList* fpl = xCalloc(1, sizeof(FreeBSDProcessList));
+@@ -301,6 +303,8 @@
+ //pl->totalMem *= pageSizeKb;
+ sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0);
+ pl->totalMem /= 1024;
++ // XXX hack
++ Global_totalMem = pl->totalMem;
+
+ sysctl(MIB_vm_stats_vm_v_active_count, 4, &(fpl->memActive), &len, NULL, 0);
+ fpl->memActive *= pageSizeKb;
+@@ -477,8 +481,9 @@
}
// from FreeBSD source /src/usr.bin/top/machine.c
@@ -8,6 +26,17 @@
- proc->m_resident = kproc->ki_rssize * pageSizeKb;
+ proc->m_size = kproc->ki_size / 1024 / pageSizeKb;
+ proc->m_resident = kproc->ki_rssize;
++ proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(Global_totalMem) * 100.0;
proc->nlwp = kproc->ki_numthreads;
proc->time = (kproc->ki_runtime + 5000) / 10000;
+@@ -487,9 +492,6 @@
+ // 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) {