Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!unido!ecrcvax!diomidis From: diomidis@ecrcvax.UUCP (Diomidis Spinellis) Newsgroups: comp.unix.questions Subject: Re: Sun OS accounting file format Summary: Interpretation of the accounting time fields Keywords: accounting time acct comp_t Message-ID: <737@ecrcvax.UUCP> Date: 8 Jun 89 19:37:43 GMT References: <1171@shell.shell.com> Reply-To: diomidis@ecrcvax.UUCP (Diomidis Spinellis) Organization: ECRC, Munich 81, West Germany Lines: 55 In article <1171@shell.shell.com> dinah@shell.UUCP (Dinah Anderson) writes: >We are trying to write our own program to create accouting reports. >According to the man page, the data ytpe for some of the fields is: > > [ ... gives the manual description of comp_t ... ] > >Can someone help me understand how to interpret this field? Comp_t is represented as a three bit base 8 exponent followed by a 13 bit mantissa. No normalisation takes place. The place of the bits in the u_short is as follows: +------+--------------------------+ | exp | mantissa | +------+--------------------------+ 15 13 12 0 Thus the value is: mantissa * 8 ** exponent and you can calculate it by: (long)(val & 017777) << ((val >> 13) * 3) >Also does anyone know what the units are for the fields : > > comp_t ac_utime; This is the total amount of time the process spent executing in user mode. > comp_t ac_stime; The total amount of time spent in the system executing on behalf of the process. > comp_t ac_etime; This is the time difference between the process creation (by fork) and the process termination (by a signal or exit). In other words the time the process has existed. The times are expressed in seconds / AHZ. You have to divide by AHZ (defined in sys/acct.h) in order to get seconds. >The man page does not say. True. You could get some info from getrusage(2). With the abudance of binary UN*X distributions the system source is no longer a viable substitute for decent documentation. It is becoming time for the vendors to get their act together and produce more complete documentation. >Dinah Anderson Diomidis -- Diomidis Spinellis European Computer-Industry Research Centre (ECRC) Arabellastrasse 17, D-8000 Muenchen 81, West Germany +49 (89) 92699199 USA: diomidis%ecrcvax.uucp@pyramid.pyramid.com ...!pyramid!ecrcvax!diomidis Europe: diomidis@ecrcvax.uucp ...!unido!ecrcvax!diomidis