[comp.unix.wizards] CPU Accounting

9531sons@WISCVM.WISC.EDU (10/13/87)

I am moving from a PDP11/70 (running BSD 2.9) to a SUN 3/280 and am
moving my "old" accounting code.

Here, at UCSB, we charge UNIX users for CPU seconds and, in fact, have
three different CPU rates depending on which time of the day the
command was executed.  Several years ago I modified the BSD 2.8 program
"sa" to fit our local needs.  I installed the program on a SUN I have
found that lots of SUN commands seem to be executing is less than a
second!  I tried the same code on a neighboring VAX 11/780 (4.2 UNIX)
and the same thing seems to occur.  My results do match up with what
/etc/sa is producing, so if I'm missing values then I'd guess /etc/sa
(BSD 4.2) is also.

The acct structure contains two fields I am concerned with, ac_utime and
ac_stime, these values appear to (often) be 0.  Occasionally a good
nroff will generate a couple of seconds but for the most part we get
0.  Is the number of seconds in ac_utime and ac_stime accurate?

                                        Jamie Sonsini
                                        UC Santa Barbara

chris@mimsy.UUCP (Chris Torek) (10/13/87)

In article <9737@brl-adm.ARPA> 9531sons@WISCVM.WISC.EDU writes:
>Here, at UCSB, we charge UNIX users for CPU seconds....  Several
>years ago I modified the BSD 2.8 program "sa" to fit our local
>needs.  I installed the program on a SUN I have found that lots of
>SUN commands seem to be executing is less than a second!  ... on a
>neighboring VAX 11/780 (4.2 UNIX) ... the same thing seems to occur.

This is a bug in the 4.2BSD accounting code, faithfully copied into
early Sun releases.  Accounting is done only in terms of whole
seconds, which is nowhere near enough to record the execution of
`ls' or `cat'.

The situation is fixed in 4.3BSD, where accounting is done in units
of 1/AHZ (Accounting Hertz) seconds, rather than whole seconds.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris