Subject: Re: new "top" almost ready to be released - netbsd problems.
To: None <tech-kern@netbsd.org>
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
List: tech-kern
Date: 01/19/1999 10:22:55
Simon Burge wrote:
> There's a new version of "top" about to go out of beta.  The current
> beta (top-3.5beta9) has a new module called "netbsd132" which seems to
> be seriously broken.

Does the 1.3 top module in beta 7 (m_netbsd13.c) have some in-built
assumptions about the value of HZ?  I ask because it only seems to report
correct WCPU and CPU totals if HZ is 100.  On the Atari port, where HZ is
typically 64, the totals for WCPU and CPU tend toward 150 or so (and
100/64 ~= 156).

The following patch makes top display correct (AFAIK) WCPU/CPU values on
all the machines that I have access to (Sparc 1.3.2/i386 1.3I/Atari 1.3H).
However, it seems odd to take out the dependency on hz in the calculations,
as it's not used anywhere else - so what have I missed?

*** m_netbsd13.c.dist	Tue Jan 19 10:07:14 1999
--- m_netbsd13.c	Tue Jan 19 10:11:01 1999
***************
*** 560,567 ****
  	    format_k(pagetok(VP(pp, vm_rssize))),
  	    state_abbrev[(unsigned char) PP(pp, p_stat)],
  	    format_time(cputime),
! 	    10000.0 * weighted_cpu(pct, pp) / hz,
! 	    10000.0 * pct / hz,
  	    printable(PP(pp, p_comm)));
  
      /* return the result */
--- 560,567 ----
  	    format_k(pagetok(VP(pp, vm_rssize))),
  	    state_abbrev[(unsigned char) PP(pp, p_stat)],
  	    format_time(cputime),
! 	    100.0 * weighted_cpu(pct, pp),
! 	    100.0 * pct,
  	    printable(PP(pp, p_comm)));
  
      /* return the result */

J

-- 
"Railways have always been plagued by politicians, and it is not hard to
think that Robert Stephenson had the right idea when he drove his engine
over one of them at the opening of the Liverpool & Manchester Railway"