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