Re: top CPU percentage off by factor of 100 on 1st iteration
[responding from debian-user]
I noticed that when I added the batch mode. I think (it has been over a
year ago now) it NEEDs two iterations as it is written to get everything
initialized properly. The correct behavior should probably be to do one
"silent" iteration right away without reporting anything, wait the delay
period, and display on the second iteration so that the fist display one
sees is really the second iteration.
I think the way it does it now is to wait the delay period before doing
the first iteration. top -b -p 1 -n 1 should show it clearly. I think I
looked at the code and decided that it was too much of a rewrite (had to
change a lot of the logic) for me to do since I was not the official
maintainer and all I needed was the batch option so I could parse output
for a process monitor I was writing at the time.
It isn't a Debian bug, it is a bug in the upstream source.
On Mon, 3 Apr 2000 email@example.com wrote:
> Package: procps
> Version: 1:2.0.6-6
> The CPU state summary for top reports percentage use values which appear
> to be off by a factor of 100 on the first iteration of an iterative
> 'top' session, or if run in one iteration in batch mode. In the example
> below, the actaul values should be closer to 8% user, 12% system, and
> 80% nice.
> This is on a single CPU i386/Woody system.
> 1:19am up 28 days, 19:37, 12 users, load average: 3.07, 3.06, 3.59
> 179 processes: 174 sleeping, 4 running, 1 zombie, 0 stopped
> CPU states: 0.0% user, 0.4% system, 1.0% nice, 0.1% idle
> Mem: 95652K av, 87584K used, 8068K free, 31540K shrd, 2424K buff
> Swap: 403772K av, 128204K used, 275568K free 24868K cached
> PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
> 11057 daemon 20 19 5980 5948 228 R N 0 34.2 6.2 133:55 prime-net
> 18339 daemon 19 19 256 232 184 R N 0 33.4 0.2 488:38 distributed-
> 14630 karsten 17 0 1248 1244 676 R 0 24.2 1.3 0:00 top
> 27318 karsten 0 0 376 276 240 S 0 1.4 0.2 295:21 asmon
> 27321 karsten 0 0 944 496 168 S 0 1.4 0.5 690:18 wmglobe
> 27265 root 0 0 60868 19M 4768 S 0 0.7 21.3 511:41 XF86_S3V
> Karsten M. Self (firstname.lastname@example.org)
> What part of "Gestalt" don't you understand?
> Unsubscribe? mail -s unsubscribe email@example.com < /dev/null
"Your mouse has moved. You must restart the system for the change to take
effect. Would you like to restart the system now?"