Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/kern pull up rev 1.66 from trunk (requested by ross):



details:   https://anonhg.NetBSD.org/src/rev/33c4acbf7321
branches:  netbsd-1-4
changeset: 469584:33c4acbf7321
user:      cgd <cgd%NetBSD.org@localhost>
date:      Sun Oct 17 22:29:40 1999 +0000

description:
pull up rev 1.66 from trunk (requested by ross):
  Correct use of `wrong' clock for %cpu calculation.  (This is not
  a  functional change at present because all clock frequencies are
  the same.)

diffstat:

 sys/kern/kern_synch.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 7193afcaa94e -r 33c4acbf7321 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Sun Oct 17 22:09:47 1999 +0000
+++ b/sys/kern/kern_synch.c     Sun Oct 17 22:29:40 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.57 1999/03/24 05:51:25 mrg Exp $      */
+/*     $NetBSD: kern_synch.c,v 1.57.2.1 1999/10/17 22:29:40 cgd Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -184,6 +184,7 @@
        register struct proc *p;
        register int s;
        register unsigned int newcpu;
+       int clkhz;
 
        wakeup((caddr_t)&lbolt);
        for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
@@ -206,15 +207,15 @@
                /*
                 * p_pctcpu is only for ps.
                 */
-               KASSERT(profhz);
+               clkhz = stathz != 0 ? stathz : hz;
 #if    (FSHIFT >= CCPU_SHIFT)
-               p->p_pctcpu += (profhz == 100)?
+               p->p_pctcpu += (clkhz == 100)?
                        ((fixpt_t) p->p_cpticks) << (FSHIFT - CCPU_SHIFT):
                        100 * (((fixpt_t) p->p_cpticks)
-                               << (FSHIFT - CCPU_SHIFT)) / profhz;
+                               << (FSHIFT - CCPU_SHIFT)) / clkhz;
 #else
                p->p_pctcpu += ((FSCALE - ccpu) *
-                       (p->p_cpticks * FSCALE / profhz)) >> FSHIFT;
+                       (p->p_cpticks * FSCALE / clkhz)) >> FSHIFT;
 #endif
                p->p_cpticks = 0;
                newcpu = (u_int)decay_cpu(loadfac, p->p_estcpu);



Home | Main Index | Thread Index | Old Index