dinah@shell.UUCP (Dinah Anderson) (06/06/89)
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: /* * Accounting structures; * these use a comp_t type which is a 3 bits base 8 * exponent, 13 bit fraction ``floating point'' number. */ Can someone help me understand how to interpret this field? Also does anyone know what the units are for the fields : comp_t ac_utime; /* Accounting user time */ comp_t ac_stime; /* Accounting system time */ comp_t ac_etime; /* Accounting elapsed time */ The man page does not say. Thanks! Dinah Anderson Shell Oil Company, Information Center (713) 795-3287 ..!{sun,psuvax,bcm,rice}!shell!dinah
diomidis@ecrcvax.UUCP (Diomidis Spinellis) (06/09/89)
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