]>
Commit | Line | Data |
---|---|---|
2fc1e207 A |
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 | .\" $FreeBSD: src/usr.sbin/sa/sa.8,v 1.15 2002/07/14 14:46:01 charnier Exp $ | |
31 | .\" | |
32 | .Dd February 25, 1994 | |
33 | .Dt SA 8 | |
34 | .Os | |
35 | .Sh NAME | |
36 | .Nm sa | |
37 | .Nd print system accounting statistics | |
38 | .Sh SYNOPSIS | |
34d340d7 | 39 | .Nm sa |
2fc1e207 A |
40 | .Op Fl abcdDfijkKlmnqrstu |
41 | .Op Fl v Ar cutoff | |
42 | .Op Ar | |
43 | .Sh DESCRIPTION | |
44 | The | |
34d340d7 | 45 | .Nm sa |
2fc1e207 A |
46 | utility reports on, cleans up, |
47 | and generally maintains system | |
48 | accounting files. | |
49 | .Pp | |
50 | The | |
34d340d7 | 51 | .Nm sa |
2fc1e207 A |
52 | utility is able to condense the information in |
53 | .Pa /var/account/acct | |
54 | into the summary files | |
55 | .Pa /var/account/savacct | |
56 | and | |
57 | .Pa /var/account/usracct , | |
58 | which contain system statistics according | |
59 | to command name and login id, respectively. | |
60 | This condensation is desirable because on a | |
61 | large system, | |
62 | .Pa /var/account/acct | |
63 | can grow by hundreds of blocks per day. | |
64 | The summary files are normally read before | |
65 | the accounting file, so that reports include | |
66 | all available information. | |
67 | .Pp | |
68 | If file names are supplied, they are read instead of | |
69 | .Pa /var/account/acct . | |
70 | After each file is read, if the summary | |
71 | files are being updated, an updated summary will | |
72 | be saved to disk. Only one report is printed, | |
73 | after the last file is processed. | |
74 | .Pp | |
75 | The labels used in the output indicate the following, except | |
76 | where otherwise specified by individual options: | |
77 | .Bl -tag -width k*sec | |
34d340d7 | 78 | .\" ========== |
2fc1e207 A |
79 | .It Dv avio |
80 | Average number of I/O operations per execution | |
34d340d7 | 81 | .\" ========== |
2fc1e207 A |
82 | .It Dv cp |
83 | Sum of user and system time, in minutes | |
34d340d7 | 84 | .\" ========== |
2fc1e207 A |
85 | .It Dv cpu |
86 | Same as | |
87 | .Dv cp | |
34d340d7 | 88 | .\" ========== |
2fc1e207 A |
89 | .It Dv k |
90 | CPU-time averaged core usage, in 1k units | |
34d340d7 | 91 | .\" ========== |
2fc1e207 A |
92 | .It Dv k*sec |
93 | CPU storage integral, in 1k-core seconds | |
34d340d7 | 94 | .\" ========== |
2fc1e207 A |
95 | .It Dv re |
96 | Real time, in minutes | |
34d340d7 | 97 | .\" ========== |
2fc1e207 A |
98 | .It Dv s |
99 | System time, in minutes | |
34d340d7 | 100 | .\" ========== |
2fc1e207 A |
101 | .It Dv tio |
102 | Total number of I/O operations | |
34d340d7 | 103 | .\" ========== |
2fc1e207 A |
104 | .It Dv u |
105 | User time, in minutes | |
106 | .El | |
107 | .Pp | |
108 | The options to | |
34d340d7 | 109 | .Nm sa |
2fc1e207 A |
110 | are: |
111 | .Bl -tag -width Ds | |
34d340d7 | 112 | .\" ========== |
2fc1e207 A |
113 | .It Fl a |
114 | List all command names, including those containing unprintable | |
115 | characters and those used only once. By default, | |
34d340d7 | 116 | .Nm sa |
2fc1e207 A |
117 | places all names containing unprintable characters and |
118 | those used only once under the name ``***other''. | |
34d340d7 | 119 | .\" ========== |
2fc1e207 A |
120 | .It Fl b |
121 | If printing command statistics, sort output by the sum of user and system | |
122 | time divided by number of calls. | |
34d340d7 | 123 | .\" ========== |
2fc1e207 A |
124 | .It Fl c |
125 | In addition to the number of calls and the user, system and real times | |
126 | for each command, print their percentage of the total over all commands. | |
34d340d7 A |
127 | .\" ========== |
128 | .It Fl D | |
129 | If printing command statistics, sort and print by the total number | |
130 | of disk I/O operations. | |
131 | .\" ========== | |
2fc1e207 A |
132 | .It Fl d |
133 | If printing command statistics, sort by the average number of disk | |
134 | I/O operations. If printing user statistics, print the average number of | |
135 | disk I/O operations per user. | |
34d340d7 | 136 | .\" ========== |
2fc1e207 A |
137 | .It Fl f |
138 | Force no interactive threshold comparison with the | |
139 | .Fl v | |
140 | option. | |
34d340d7 | 141 | .\" ========== |
2fc1e207 A |
142 | .It Fl i |
143 | Do not read in the summary files. | |
34d340d7 | 144 | .\" ========== |
2fc1e207 A |
145 | .It Fl j |
146 | Instead of the total minutes per category, give seconds per call. | |
34d340d7 A |
147 | .\" ========== |
148 | .It Fl K | |
149 | If printing command statistics, print and sort by the cpu-storage integral. | |
150 | .\" ========== | |
2fc1e207 A |
151 | .It Fl k |
152 | If printing command statistics, sort by the cpu-time average memory | |
153 | usage. If printing user statistics, print the cpu-time average | |
154 | memory usage. | |
34d340d7 | 155 | .\" ========== |
2fc1e207 A |
156 | .It Fl l |
157 | Separate system and user time; normally they are combined. | |
34d340d7 | 158 | .\" ========== |
2fc1e207 A |
159 | .It Fl m |
160 | Print per-user statistics rather than per-command statistics. | |
34d340d7 | 161 | .\" ========== |
2fc1e207 A |
162 | .It Fl n |
163 | Sort by number of calls. | |
34d340d7 | 164 | .\" ========== |
2fc1e207 A |
165 | .It Fl q |
166 | Create no output other than error messages. | |
34d340d7 | 167 | .\" ========== |
2fc1e207 A |
168 | .It Fl r |
169 | Reverse order of sort. | |
34d340d7 | 170 | .\" ========== |
2fc1e207 A |
171 | .It Fl s |
172 | Truncate the accounting files when done and merge their data | |
173 | into the summary files. | |
34d340d7 | 174 | .\" ========== |
2fc1e207 A |
175 | .It Fl t |
176 | For each command, report the ratio of real time to the sum | |
177 | of user and system cpu times. | |
178 | If the cpu time is too small to report, ``*ignore*'' appears in | |
179 | this field. | |
34d340d7 | 180 | .\" ========== |
2fc1e207 A |
181 | .It Fl u |
182 | Superseding all other flags, for each entry | |
183 | in the accounting file, print the user ID, total seconds of cpu usage, | |
184 | total memory usage, number of I/O operations performed, and | |
185 | command name. | |
34d340d7 | 186 | .\" ========== |
2fc1e207 A |
187 | .It Fl v Ar cutoff |
188 | For each command used | |
189 | .Ar cutoff | |
190 | times or fewer, print the command name and await a reply | |
191 | from the terminal. If the reply begins with ``y'', add | |
192 | the command to the category ``**junk**''. This flag is | |
193 | used to strip garbage from the report. | |
194 | .El | |
195 | .Pp | |
196 | By default, per-command statistics will be printed. The number of | |
197 | calls, the total elapsed time in minutes, total cpu and user time | |
198 | in minutes, average number of I/O operations, and CPU-time | |
199 | averaged core usage will be printed. If the | |
200 | .Fl m | |
201 | option is specified, per-user statistics will be printed, including | |
202 | the user name, the number of commands invoked, total cpu time used | |
203 | (in minutes), total number of I/O operations, and CPU storage integral | |
204 | for each user. If the | |
205 | .Fl u | |
206 | option is specified, the uid, user and system time (in seconds), | |
207 | CPU storage integral, I/O usage, and command name will be printed | |
208 | for each entry in the accounting data file. | |
209 | .Pp | |
210 | If the | |
211 | .Fl u | |
212 | flag is specified, all flags other than | |
213 | .Fl q | |
214 | are ignored. If the | |
215 | .Fl m | |
216 | flag is specified, only the | |
217 | .Fl b , | |
218 | .Fl d , | |
219 | .Fl i , | |
220 | .Fl k , | |
221 | .Fl q , | |
222 | and | |
223 | .Fl s | |
224 | flags are honored. | |
225 | .Sh DIAGNOSTICS | |
226 | .Ex -std | |
227 | .Sh FILES | |
228 | .Bl -tag -width /var/account/usracct -compact | |
229 | .It Pa /var/account/acct | |
230 | raw accounting data file | |
231 | .It Pa /var/account/savacct | |
232 | per-command accounting summary database | |
233 | .It Pa /var/account/usracct | |
234 | per-user accounting summary database | |
235 | .El | |
236 | .Sh SEE ALSO | |
237 | .Xr lastcomm 1 , | |
238 | .Xr acct 5 , | |
239 | .Xr ac 8 , | |
240 | .Xr accton 8 | |
241 | .Sh BUGS | |
242 | The number of options to this program is absurd, especially considering | |
243 | that there's not much logic behind their lettering. | |
244 | .Pp | |
245 | The field labels should be more consistent. | |
246 | .Pp | |
247 | The VM system does not record the CPU storage integral. | |
248 | .Sh CAVEATS | |
249 | While the behavior of the options in this version of | |
34d340d7 | 250 | .Nm sa |
2fc1e207 A |
251 | was modeled after the original version, there are some intentional |
252 | differences and undoubtedly some unintentional ones as well. In | |
253 | particular, the | |
254 | .Fl q | |
255 | option has been added, and the | |
256 | .Fl m | |
257 | option now understands more options than it used to. | |
258 | .Pp | |
259 | The formats of the summary files created by this version of | |
34d340d7 | 260 | .Nm sa |
2fc1e207 A |
261 | are very different from the those used by the original version. |
262 | This is not considered a problem, however, because the accounting record | |
263 | format has changed as well (since user ids are now 32 bits). | |
264 | .Sh AUTHORS | |
265 | .An Chris G. Demetriou Aq cgd@postgres.berkeley.edu |