[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kernel/3702: invalid CPU% in 3.5 snapshot



>Number:         3702
>Category:       kernel
>Synopsis:       CPU % is reported incorrectly
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 07 19:40:01 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     francisco
>Release:        3.5
>Organization:
>Environment:
	System      : OpenBSD 3.5
	Architecture: OpenBSD.i386
	Machine     : i386
>Description:
	CPU percentages in various programs are returning as 0.00%
>How-To-Repeat:
	Run top in 3.5 snapshot from 20040301
>Fix:
	I guessed that the problem is in kern_proc.c, so i tried the following
two patches.  I assume the first is better since the second just backs out of
the change made in 1.17->1.18.  Both seem to have the same effect for me (i see
a non-zero cpu % in top).


--- src/sys/kern/kern_proc.c.orig	Wed Feb 11 04:33:05 2004
+++ src/sys/kern/kern_proc.c	Sun Mar  7 14:13:09 2004
@@ -406,7 +406,7 @@
 	(*pr)("    user=%p, vmspace=%p\n",
 	    p->p_addr, p->p_vmspace);
 	(*pr)("    estcpu=%u, cpticks=%d, pctcpu=%u.%u%, swtime=%u\n",
-	    p->p_estcpu, p->p_cpticks, p->p_pctcpu / 100, p->p_pctcpu % 100,
+	    p->p_estcpu, p->p_cpticks, p->p_pctcpu, p->p_pctcpu % 100,
 	    p->p_swtime);
 	(*pr)("    user=%llu, sys=%llu, intr=%llu\n",
 	    p->p_uticks, p->p_sticks, p->p_iticks);


--- sys/kern/kern_proc.c.orig	Wed Feb 11 04:33:05 2004
+++ sys/kern/kern_proc.c	Sun Mar  7 12:30:44 2004
@@ -405,7 +405,7 @@
 	    p->p_forw, p->p_back, p->p_list.le_next, p->p_list.le_prev);
 	(*pr)("    user=%p, vmspace=%p\n",
 	    p->p_addr, p->p_vmspace);
-	(*pr)("    estcpu=%u, cpticks=%d, pctcpu=%u.%u%, swtime=%u\n",
+	(*pr)("    estcpu=%u, cpticks=%d, pctcpu=%d.%d%, swtime=%u\n",
 	    p->p_estcpu, p->p_cpticks, p->p_pctcpu / 100, p->p_pctcpu % 100,
 	    p->p_swtime);
 	(*pr)("    user=%llu, sys=%llu, intr=%llu\n",


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