misc/144285: ps -axo user, %cpu, %mem - most processes using 0% of memory

Alex Keda admin at lissyara.su
Thu Feb 25 14:50:01 UTC 2010


>Number:         144285
>Category:       misc
>Synopsis:       ps -axo user,%cpu,%mem - most processes using 0% of memory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 25 14:50:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alex Keda
>Release:        7.2-STABLE
>Organization:
USSR
>Environment:
FreeBSD srv2.host-food.ru 7.2-STABLE FreeBSD 7.2-STABLE #0: Sun Oct  4 01:38:34 MSD 2009     lissyara at srv.host-food.ru:/home/obj/usr/src/sys/HOST-FOOD  i386

>Description:
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.

>How-To-Repeat:
ps -axo user,%cpu,%mem
>Fix:
see patch

Patch attached with submission follows:

--- /usr/src/bin/ps/print.c.orig	2010-01-22 23:09:53.000000000 +0300
+++ /usr/src/bin/ps/print.c	2010-01-22 23:10:06.000000000 +0300
@@ -645,7 +645,7 @@
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%*.1f", v->width, getpcpu(k));
+	(void)printf("%*.2f", v->width, getpcpu(k));
 }
 
 static double
@@ -673,7 +673,7 @@
 	VAR *v;
 
 	v = ve->var;
-	(void)printf("%*.1f", v->width, getpmem(k));
+	(void)printf("%*.2f", v->width, getpmem(k));
 }
 
 void


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list