[TEST/REVIEW] CPU accounting patches

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jan 25 11:09:59 PST 2006

In message <E1F1kOm-000FY2-8Z at hetzner.co.za>, Ian FREISLICH writes:

>"One second's worth of the computer's processing time, which is
>based on actual machine cycles used, not calendar time." ?
>Is the getrusage() manual page out of date?


It was written before anybody had gotten the rather weird idea to
have a CPU change frequency.  Back then it was all about running
as fast as possible all the time.

We are therefore forced to try to divine the intent behind the text,
and as somebody who were around back in the eighties I can testify
that the intent was to be able to bill computer users for CPU

Since the clock rate was constant, cpu seconds was a usable

These days with variable clockrate, the cpu second is a bad approximation.
If my CPU runs at 600MHz, even if used 100%, it can still do three times
as much work, so the fact that my process takes 3 seconds to complete
does not mean that I have used (in the sense of denying other users the
ability to use) all of the CPU for three seconds.  If I had monopolized
the entire CPU to its fullest potential, it would have taken only one

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the freebsd-current mailing list