1acct.h(3HEAD) Headers acct.h(3HEAD)
2
3
4
6 acct.h, acct - per-process accounting file format
7
9 #include <sys/types.h>
10 #include <sys/acct.h>
11
12
14 Files produced as a result of calling acct(2) have records in the form
15 defined by <sys/acct.h>, whose contents are:
16
17 typedef ushort_t comp_t; /* pseudo "floating point"
18 representation */
19 /* 3 bit base-8 exponent in the high */
20 /* order bits, and a 13-bit fraction */
21 /* in the low order bits. */
22
23 struct acct
24 {
25 char ac_flag; /* Accounting flag */
26 char ac_stat; /* Exit status */
27 uid_t ac_uid; /* Accounting user ID */
28 gid_t ac_gid; /* Accounting group ID */
29 dev_t ac_tty; /* control tty */
30 time_t ac_btime; /* Beginning time */
31 comp_t ac_utime; /* accounting user time in clock ticks */
32 comp_t ac_stime; /* accounting system time in clock ticks */
33 comp_t ac_etime; /* accounting total elapsed time in clock
34 ticks */
35 comp_t ac_mem; /* memory usage in clicks (pages) */
36 comp_t ac_io; /* chars transferred by read/write */
37 comp_t ac_rw; /* number of block reads/writes */
38 char ac_comm[8]; /* command name */
39 };
40
41 /*
42 * Accounting Flags
43 */
44
45 #define AFORK 01 /* has executed fork, but no exec */
46 #define ASU 02 /* used super-user privileges */
47 #define ACCTF 0300 /* record type */
48 #define AEXPND 040 /* Expanded Record Type − default */
49
50
51
52 In ac_flag, the AFORK flag is turned on by each fork and turned off by
53 an exec. The ac_comm field is inherited from the parent process and is
54 reset by any exec. Each time the system charges the process with a
55 clock tick, it also adds to ac_mem the current process size, computed
56 as follows:
57
58
59 (data size) + (text size) / (number of in-core processes using text)
60
61
62 The value of ac_mem/(ac_stime+ac_utime) can be viewed as an approxima‐
63 tion to the mean process size, as modified by text sharing.
64
65
66 The structure tacct, (which resides with the source files of the
67 accounting commands), represents a summary of accounting statistics for
68 the user id ta_uid. This structure is used by the accounting commands
69 to report statistics based on user id.
70
71 /*
72 * total accounting (for acct period), also for day
73 */
74 struct tacct {
75 uid_t ta_uid; /* user id */
76 char ta_name[8]; /* login name */
77 float ta_cpu[2]; /* cum. cpu time in minutes, */
78 /* p/np (prime/non-prime time) */
79 float ta_kcore[2]; /* cum. kcore-minutes, p/np */
80 float ta_con[2]; /* cum. connect time in minutes,
81 p/np */
82 float ta_du; /* cum. disk usage (blocks)*/
83 long ta_pc; /* count of processes */
84 unsigned short ta_sc; /* count of login sessions */
85 unsigned short ta_dc; /* count of disk samples */
86 unsigned short ta_fee; /* fee for special services */
87 };
88
89
90
91 The ta_cpu, ta_kcore, and ta_con members contain usage information per‐
92 taining to prime time and non-prime time hours. The first element in
93 each array represents the time the resource was used during prime time
94 hours. The second element in each array represents the time the
95 resource was used during non-prime time hours. Prime time and non-
96 prime time hours may be set in the holidays file (see holidays(4)).
97
98
99 The ta_kcore member is a cumulative measure of the amount of memory
100 used over the accounting period by processes owned by the user with
101 uid ta_uid. The amount shown represents kilobyte segments of memory
102 used, per minute.
103
104
105 The ta_con member represents the amount of time the user was logged in
106 to the system.
107
109 /etc/acct/holidays prime/non-prime time table
110
111
113 acctcom(1), acct(1M), acctcon(1M), acctmerg(1M), acctprc(1M),
114 acctsh(1M), prtacct(1M), runacct(1M), shutacct(1M), acct(2), exec(2),
115 fork(2)
116
118 The ac_mem value for a short-lived command gives little information
119 about the actual size of the command, because ac_mem may be incremented
120 while a different command (for example, the shell) is being executed by
121 the process.
122
123
124
125SunOS 5.11 19 May 1994 acct.h(3HEAD)