Accounting problems in 4.2
Alex White
arwhite at watmath.UUCP
Wed Feb 1 01:58:39 AEST 1984
Somebody posted something in the last month complaining about problems in
accounting cpu times - I don't remember who cuz I assumed that somebody
would have posted an answer and it was only several hundred messages later
that I realized nobody had...
Unfortunately, I think this still has the problem that only seconds of cpu
are actually being recorded... This only fixes the memory usage (which we
happen to account for).
Subject: Accounting time quantities screwed up
Index: sys/sys/kern_acct.c etc/sa.c 4.2BSD
Description:
Accounting records now write times out in seconds, sa still works in
60ths of seconds.
Accounting entry ac_mem is incorrect as the kernel divides by
SECONDS, the integrated memory usage which is in NBPG ticks.
Repeat-By:
Use sa -u to see what's being printed out, its wrong.
Fix:
I can't provide the fix to sa because we have so many changes in it
to make it work on uid/gid basis that a diff listing would be horrible.
However, basically, everywhere that uses a time currently divides by
60 to get rid of the old hz factor. e.g. routine col() divides by either
60 or 3600 depending on whether it wants seconds or minutes when it
should be just divide by 60 for minutes.
*** /sys/sys/kern_acct.c Fri Dec 2 14:09:33 1983
--- /usr/distr/4.2/sys/sys/kern_acct.c Fri Jul 29 10:07:16 1983
***************
*** 98,106
ap->ac_gid = u.u_rgid;
ap->ac_mem = 0;
! /*
! * Note that ru_i?rss is in units of NBPG core tick
! */
! if (i = (u.u_ru.ru_utime.tv_sec + u.u_ru.ru_stime.tv_sec)*hz +
! (u.u_ru.ru_utime.tv_usec + u.u_ru.ru_stime.tv_usec)/tick)
ap->ac_mem =
(u.u_ru.ru_ixrss + u.u_ru.ru_idrss + u.u_ru.ru_isrss) / i;
--- 98,102 -----
ap->ac_gid = u.u_rgid;
ap->ac_mem = 0;
! if (i = u.u_ru.ru_utime.tv_sec + u.u_ru.ru_stime.tv_sec)
ap->ac_mem =
(u.u_ru.ru_ixrss + u.u_ru.ru_idrss + u.u_ru.ru_isrss) / i;
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list