[comp.unix.questions] Meaning of %CPU in top/ps

thomson@zazen.macc.wisc.edu (Don Thomson) (04/23/91)

I'm not sure how UNIX-generic the "top" program is, but its one of the main
tools we use to analyze performance on our DECstation 3100 running Ultrix 4.0.
We are trying to clarify the meaning of the percentage CPU time that is
displayed.  We're looking at percentage idle and guessing that percentage CPU
time used + idle time should add up to 100%, but are rarely seeing CPU
percentages wander over 1 or 2%.  I have a feeling we're comparing apples and
oranges here, so am looking for clarification of what exactly we're looking
at:

last pid:  8233;  load averages: 0.64, 0.56, 0.00                      12:03:09
 59 processes: 55 sleeping, 1 running, 3 stopped
Cpu states:  5.2% user,  0.0% nice, 21.0% system, 73.8% idle              zazen
Memory:  9536K ( 5360K) real, 27388K (17316K) virtual,  1296K free

  PID USERNAME PRI NICE   SIZE   RES STATE   TIME   WCPU    CPU COMMAND
 8213 thomson   25    0   612K  396K run     0:00  1.95%  1.95% top
 8232 root       1    0   172K   64K sleep   0:00  0.39%  0.39% nntpxmit
21060 thomson   26    0  7828K 2648K stop    4:39  0.00%  0.00% emacs

The top man page says:

	WCPU is the weighted cpu percentage (this is the same value that
	ps(1) displays as CPU), CPU is the raw percentage and is the
	field that is sorted to determine the order of the processes

and the ps man page says:

	%CPU      CPU utilization of the process.  This is a decaying
                  average over a minute or less of previous (real) time.
                  Because the time base over which this is computed
                  varies since processes may be very young, it is possi-
                  ble for the sum of all %CPU fields to exceed 200%.

Can anyone help shed any light on exactly what kind of measurements we're
seeing here, and/or clarify the distinction between weighted and raw CPU
percentages?  Thanks!
--
 
----- Don Thomson ----- MACC, 1210 W. Dayton, Madison, WI  53706 -------------
    (608) 262-0138      thomson@macc.wisc.edu / thomson@wiscmacc.bitnet