ps -axo user,%cpu,%mem - most processes using 0% of memory

Alex Keda admin at lissyara.su
Tue Jan 19 06:30:04 UTC 2010


Hi!
Modern computers have a large amount of memory.
But, in ps(1) source I see:
(void)printf("%*.1f", v->width, getpcpu(k));
(void)printf("%*.1f", v->width, getpmem(k));
0.1% - it very big.
for 8Gb ram it = 8mb
Many of the processes is less than this number.

I attach patch to correct this

srv2# diff -Nru bin/ps/print.c ~lissyara/print.c
--- bin/ps/print.c      2009-09-07 13:51:23.000000000 +0400
+++ /usr/home/lissyara/print.c  2010-01-19 09:17:25.000000000 +0300
@@ -629,7 +629,7 @@
        VAR *v;

        v = ve->var;
-       (void)printf("%*.1f", v->width, getpcpu(k));
+       (void)printf("%*.2f", v->width, getpcpu(k));
 }

 static double
@@ -657,7 +657,7 @@
        VAR *v;

        v = ve->var;
-       (void)printf("%*.1f", v->width, getpmem(k));
+       (void)printf("%*.2f", v->width, getpmem(k));
 }

 void
srv2#  


More information about the freebsd-current mailing list