Commit | Line | Data |
---|---|---|
7e7051a8 GR |
1 | .\" |
2 | .\" Copyright (c) 1994 Christopher G. Demetriou | |
3 | .\" All rights reserved. | |
4 | .\" | |
5 | .\" Redistribution and use in source and binary forms, with or without | |
6 | .\" modification, are permitted provided that the following conditions | |
7 | .\" are met: | |
8 | .\" 1. Redistributions of source code must retain the above copyright | |
9 | .\" notice, this list of conditions and the following disclaimer. | |
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
11 | .\" notice, this list of conditions and the following disclaimer in the | |
12 | .\" documentation and/or other materials provided with the distribution. | |
13 | .\" 3. All advertising materials mentioning features or use of this software | |
14 | .\" must display the following acknowledgement: | |
15 | .\" This product includes software developed by Christopher G. Demetriou. | |
16 | .\" 3. The name of the author may not be used to endorse or promote products | |
17 | .\" derived from this software without specific prior written permission | |
18 | .\" | |
19 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
20 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
21 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
22 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
23 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
24 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
28 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | .\" | |
30 | .\" $Id: sa.8,v 1.1 1994/03/24 18:41:59 cgd Exp $ | |
31 | .\" | |
32 | .Dd February 25, 1994 | |
33 | .Dt SA 8 | |
34 | .Os NetBSD 0.9a | |
35 | .Sh NAME | |
36 | .Nm sa | |
37 | .Nd print system accounting statistics | |
38 | .Sh SYNOPSIS | |
39 | .Nm sa | |
40 | .Op Fl abcdDfijkKlmnqrstu | |
41 | .Op Fl v Ar cutoff | |
42 | .Op Ar | |
43 | .Sh DESCRIPTION | |
44 | The | |
45 | .Nm sa | |
46 | utility reports on, cleans up, | |
47 | and generally maintains system | |
48 | accounting files. | |
49 | .Pp | |
50 | .Nm Sa | |
51 | is able to condense the the information in | |
52 | .Pa /var/account/acct | |
53 | into the summary files | |
54 | .Pa /var/account/savacct | |
55 | and | |
56 | .Pa /var/account/usracct , | |
57 | which contain system statistics according | |
58 | to command name and login id, respectively. | |
59 | This condensation is desirable because on a | |
60 | large system, | |
61 | .Pa /var/account/acct | |
62 | can grow by hundreds of blocks per day. | |
63 | The summary files are normally read before | |
64 | the accounting file, so that reports include | |
65 | all available information. | |
66 | .Pp | |
67 | If file names are supplied, they are read instead of | |
68 | .Pa /var/account/account . | |
69 | After each file is read, if the summary | |
70 | files are being updated, an updated summary will | |
71 | be saved to disk. Only one report is printed, | |
72 | after the last file is processed. | |
73 | .Pp | |
74 | The labels used in the output indicate the following, except | |
75 | where otherwise specified by individual options: | |
76 | .Bl -tag -width k*sec | |
77 | .It Dv avio | |
78 | Average number of I/O operations per execution | |
79 | .It Dv cp | |
80 | Sum of user and system time, in minutes | |
81 | .It Dv cpu | |
82 | Same as | |
83 | .Dv cp | |
84 | .It Dv k | |
85 | CPU-time averaged core usage, in 1k units | |
86 | .It Dv k*sec | |
87 | CPU storage integral, in 1k-core seconds | |
88 | .It Dv re | |
89 | Real time, in minutes | |
90 | .It Dv s | |
91 | System time, in minutes | |
92 | .It Dv tio | |
93 | Total number of I/O operations | |
94 | .It Dv u | |
95 | User time, in minutes | |
96 | .El | |
97 | .Pp | |
98 | The options to | |
99 | .Nm sa | |
100 | are: | |
101 | .Bl -tag -width Ds | |
102 | .It Fl a | |
103 | List all command names, including those containing unprintable | |
104 | characters and those used only once. By default, | |
105 | .Nm sa | |
106 | places all names containing unprintable characters and | |
107 | those used only once under the name ``***other''. | |
108 | .It Fl b | |
109 | If printing command statistics, sort output by the sum of user and system | |
110 | time divided by number of calls. | |
111 | .It Fl c | |
112 | In addition to the number of calls and the user, system and real times | |
113 | for each command, print their percentage of the total over all commands. | |
114 | .It Fl d | |
115 | If printing command statistics, sort by the average number of disk | |
116 | I/O operations. If printing user statistics, print the average number of | |
117 | disk I/O operations per user. | |
118 | .It Fl D | |
119 | If printing command statistics, sort and print by the total number | |
120 | of disk I/O operations. | |
121 | .It Fl f | |
122 | Force no interactive threshold comparison with the | |
123 | .Fl v | |
124 | option. | |
125 | .It Fl i | |
126 | Do not read in the summary files. | |
127 | .It Fl j | |
128 | Instead of the total minutes per category, give seconds per call. | |
129 | .It Fl k | |
130 | If printing command statistics, sort by the cpu-time average memory | |
131 | usage. If printing user statistics, print the cpu-time average | |
132 | memory usage. | |
133 | .It Fl K | |
134 | If printing command statistics, print and sort by the cpu-storage integral. | |
135 | .It Fl l | |
136 | Separate system and user time; normally they are combined. | |
137 | .It Fl m | |
138 | Print per-user statistics rather than per-command statistics. | |
139 | .It Fl n | |
140 | Sort by number of calls. | |
141 | .It Fl q | |
142 | Create no output other than error messages. | |
143 | .It Fl r | |
144 | Reverse order of sort. | |
145 | .It Fl s | |
146 | Truncate the accounting files when done and merge their data | |
147 | into the summary files. | |
148 | .It Fl t | |
149 | For each command, report the ratio of real time to the sum | |
150 | of user and system cpu times. | |
151 | If the cpu time is too small to report, ``*ignore*'' appears in | |
152 | this field. | |
153 | .It Fl u | |
154 | Superseding all other flags, for each entry | |
155 | in the accounting file, print the user ID, total seconds of cpu usage, | |
156 | total memory usage, number of I/O operations performed, and | |
157 | command name. | |
158 | .It Fl v Ar cutoff | |
159 | For each command used | |
160 | .Ar cutoff | |
161 | times or fewer, print the command name and await a reply | |
162 | from the terminal. If the reply begins with ``y'', add | |
163 | the command to the category ``**junk**''. This flag is | |
164 | used to strip garbage from the report. | |
165 | .El | |
166 | .Pp | |
167 | By default, per-command statistics will be printed. The number of | |
168 | calls, the total elapsed time in minutes, total cpu and user time | |
169 | in minutes, average number of I/O operations, and CPU-time | |
170 | averaged core usage will be printed. If the | |
171 | .Fl m | |
172 | option is specified, per-user statistics will be printed, including | |
173 | the user name, the number of commands invoked, total cpu time used | |
174 | (in minutes), total number of I/O operations, and CPU storage integral | |
175 | for each user. If the | |
176 | .Fl u | |
177 | option is specified, the uid, user and system time (in seconds), | |
178 | CPU storage integral, I/O usage, and command name will be printed | |
179 | for each entry in the accounting data file. | |
180 | .Pp | |
181 | If the | |
182 | .Fl u | |
183 | flag is specified, all flags other than | |
184 | .Fl q | |
185 | are ignored. If the | |
186 | .Fl m | |
187 | flag is specified, only the | |
188 | .Fl b , | |
189 | .Fl d , | |
190 | .Fl i , | |
191 | .Fl k , | |
192 | .Fl q , | |
193 | and | |
194 | .Fl s | |
195 | flags are honored. | |
196 | .Pp | |
197 | The | |
198 | .Nm sa | |
199 | utility exits 0 on success, and >0 if an error occurs. | |
200 | .Sh FILES | |
201 | .Bl -tag -width /var/account/usracct -compact | |
202 | .It Pa /var/account/acct | |
203 | raw accounting data file | |
204 | .It Pa /var/account/savacct | |
205 | per-command accounting summary database | |
206 | .It Pa /var/account/usracct | |
207 | per-user accounting summary database | |
208 | .El | |
209 | .Sh SEE ALSO | |
210 | .Xr ac 8 , | |
211 | .Xr acct 5 , | |
212 | .Xr accton 8 , | |
213 | .Xr lastcomm 1 | |
214 | .Sh BUGS | |
215 | The number of options to this program is absurd, especially considering | |
216 | that there's not much logic behind their lettering. | |
217 | .Pp | |
218 | The field labels should be more consistent. | |
219 | .Pp | |
220 | NetBSD's VM system does not record the CPU storage integral. | |
221 | .Sh CAVEATS | |
222 | While the behavior of the options in this version of | |
223 | .Nm sa | |
224 | was modeled after the original version, there are some intentional | |
225 | differences and undoubtedly some unintentional ones as well. In | |
226 | particular, the | |
227 | .Fl q | |
228 | option has been added, and the | |
229 | .Fl m | |
230 | option now understands more options than it used to. | |
231 | .Pp | |
232 | The formats of the summary files created by this version of | |
233 | .Nm sa | |
234 | are very different than the those used by the original version. | |
235 | This is not considered a problem, however, because the accounting record | |
236 | format has changed as well (since user ids are now 32 bits). | |
237 | .Sh HISTORY | |
238 | .Nm Sa | |
239 | was written for | |
240 | .Nx 0.9a | |
241 | from the specification provided by various systems' manual pages. | |
242 | Its date of origin is unknown to the author. | |
243 | .Sh AUTHOR | |
244 | .Bl -tag | |
245 | Chris G. Demetriou, cgd@postgres.berkeley.edu | |
246 | .El |