2 .\" Copyright (c) 1994 Christopher G. Demetriou
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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
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.
30 .\" $FreeBSD: src/usr.sbin/sa/sa.8,v 1.20 2007/05/18 12:36:10 dds Exp $
37 .Nd print system accounting statistics
40 .Op Fl abcdDfijkKlmnqrstu
48 utility reports on, cleans up,
49 and generally maintains system
54 utility is able to condense the information in
56 into the summary files
57 .Pa /var/account/savacct
59 .Pa /var/account/usracct ,
60 which contain system statistics according
61 to command name and login id, respectively.
62 This condensation is desirable because on a
65 can grow by hundreds of blocks per day.
66 The summary files are normally read before
67 the accounting file, so that reports include
68 all available information.
70 If file names are supplied, they are read instead of
71 .Pa /var/account/acct .
72 After each file is read, if the summary
73 files are being updated, an updated summary will
75 Only one report is printed,
76 after the last file is processed.
78 The labels used in the output indicate the following, except
79 where otherwise specified by individual options:
82 Average number of I/O operations per execution
84 Sum of user and system time, in minutes
89 CPU-time averaged core usage, in 1k units
91 CPU storage integral, in 1k-core seconds
95 System time, in minutes
97 Total number of I/O operations
107 List all command names, including those containing unprintable
108 characters and those used only once.
111 places all names containing unprintable characters and
112 those used only once under the name ``***other''.
114 If printing command statistics, sort output by the sum of user and system
115 time divided by number of calls.
117 In addition to the number of calls and the user, system and real times
118 for each command, print their percentage of the total over all commands.
120 If printing command statistics, sort by the average number of disk
122 If printing user statistics, print the average number of
123 disk I/O operations per user.
125 If printing command statistics, sort and print by the total number
126 of disk I/O operations.
128 Force no interactive threshold comparison with the
132 Do not read in the summary files.
134 Instead of the total minutes per category, give seconds per call.
136 If printing command statistics, sort by the cpu-time average memory
138 If printing user statistics, print the cpu-time average
141 If printing command statistics, print and sort by the cpu-storage integral.
143 Separate system and user time; normally they are combined.
145 Print per-user statistics rather than per-command statistics.
147 Sort by number of calls.
151 for accessing the per-command accounting summary database,
152 instead of the default
153 .Pa /var/account/savacct .
155 Create no output other than error messages.
157 Reverse order of sort.
159 Truncate the accounting files when done and merge their data
160 into the summary files.
162 For each command, report the ratio of real time to the sum
163 of user and system cpu times.
164 If the cpu time is too small to report, ``*ignore*'' appears in
169 for accessing the per-user accounting summary database,
170 instead of the default
171 .Pa /var/account/usracct .
173 Superseding all other flags, for each entry
174 in the accounting file, print the user ID, total seconds of cpu usage,
175 total memory usage, number of I/O operations performed, and
178 For each command used
180 times or fewer, print the command name and await a reply
182 If the reply begins with ``y'', add
183 the command to the category ``**junk**''.
185 used to strip garbage from the report.
188 By default, per-command statistics will be printed.
190 calls, the total elapsed time in minutes, total cpu and user time
191 in minutes, average number of I/O operations, and CPU-time
192 averaged core usage will be printed.
195 option is specified, per-user statistics will be printed, including
196 the user name, the number of commands invoked, total cpu time used
197 (in minutes), total number of I/O operations, and CPU storage integral
201 option is specified, the uid, user and system time (in seconds),
202 CPU storage integral, I/O usage, and command name will be printed
203 for each entry in the accounting data file.
207 flag is specified, all flags other than
212 flag is specified, only the
222 .Bl -tag -width /var/account/usracct -compact
223 .It Pa /var/account/acct
224 raw accounting data file
225 .It Pa /var/account/savacct
226 per-command accounting summary database
227 .It Pa /var/account/usracct
228 per-user accounting summary database
238 While the behavior of the options in this version of
240 was modeled after the original version, there are some intentional
241 differences and undoubtedly some unintentional ones as well.
245 option has been added, and the
247 option now understands more options than it used to.
249 The formats of the summary files created by this version of
251 are very different from the those used by the original version.
252 This is not considered a problem, however, because the accounting record
253 format has changed as well (since user ids are now 32 bits).
255 .An Chris G. Demetriou Aq cgd@postgres.berkeley.edu
257 The number of options to this program is absurd, especially considering
258 that there is not much logic behind their lettering.
260 The field labels should be more consistent.
262 The VM system does not record the CPU storage integral.