SA(8) System Manager's Manual SA(8)
sa, accton - system accounting
sa [ -abcdDfijkKlnrstu ] [ -v threshold ] [ -S savacctfile ] [ -U usracctfile ] [ file ]
accton [ file ]
With an argument naming an existing file, accton causes system accounting information for every process executed to be placed at the end of
the file. If no argument is given, accounting is turned off.
Sa reports on, cleans up, and generally maintains accounting files.
Sa is able to condense the information in /usr/adm/acct into a summary file /usr/adm/savacct which contains a count of the number of times
each command was called and the time resources consumed. This condensation is desirable because on a large system /usr/adm/acct can grow
by 100 blocks per day. The summary file is normally read before the accounting file, so the reports include all available information.
If a file name is given as the last argument, that file will be treated as the accounting file; /usr/adm/acct is the default.
Output fields are labeled: "cpu" for the sum of user+system time (in minutes), "re" for real time (also in minutes), "k" for cpu-time aver-
aged core usage (in 1k units), "avio" for average number of i/o operations per execution. With options fields labeled "tio" for total i/o
operations, "k*sec" for cpu storage integral (kilo-core seconds), "u" and "s" for user and system cpu time alone (both in minutes) will
There are near a googol of options:
a Print all command names, even those containing unprintable characters and those used only once. By default, those are placed under
the name `***other.'
b Sort output by sum of user and system time divided by number of calls. Default sort is by sum of user and system times.
c Besides total user, system, and real time for each command print percentage of total time over all commands.
d Sort by average number of disk i/o operations.
D Print and sort by total number of disk i/o operations.
f Force no interactive threshold compression with -v flag.
i Don't read in summary file.
j Instead of total minutes time for each category, give seconds per call.
k Sort by cpu-time average memory usage.
K Print and sort by cpu-storage integral.
l Separate system and user time; normally they are combined.
m Print number of processes and number of CPU minutes for each user.
n Sort by number of calls.
r Reverse order of sort.
s Merge accounting file into summary file /usr/adm/savacct when done.
t For each command report ratio of real time to the sum of user and system times.
u Superseding all other flags, print for each command in the accounting file the user ID and command name.
v Followed by a number n, types the name of each command used n times or fewer. Await a reply from the terminal; if it begins with
`y', add the command to the category `**junk**.' This is used to strip out garbage.
S The following filename is used as the command summary file instead of /usr/adm/savacct.
U The following filename is used instead of /usr/adm/usracct to accumulate the per-user statistics printed by the -m option.
/usr/adm/acct raw accounting
/usr/adm/usracct per-user summary
The number of options to this program is absurd.
4th Berkeley Distribution November 16, 1996 SA(8)
Check Out this Related Man Page
SA(8) BSD System Manager's Manual SA(8)
sa -- print system accounting statistics
sa [-abcdDfijkKlmnqrstu] [-P file] [-U file] [-v cutoff] [file ...]
The sa utility reports on, cleans up, and generally maintains system accounting files.
The sa utility is able to condense the information in /var/account/acct into the summary files /var/account/savacct and /var/account/usracct,
which contain system statistics according to command name and login id, respectively. This condensation is desirable because on a large sys-
tem, /var/account/acct can grow by hundreds of blocks per day. The summary files are normally read before the accounting file, so that
reports include all available information.
If file names are supplied, they are read instead of /var/account/acct. After each file is read, if the summary files are being updated, an
updated summary will be saved to disk. Only one report is printed, after the last file is processed.
The labels used in the output indicate the following, except where otherwise specified by individual options:
avio Average number of I/O operations per execution
cp Sum of user and system time, in minutes
cpu Same as cp
k CPU-time averaged core usage, in 1k units
k*sec CPU storage integral, in 1k-core seconds
re Real time, in minutes
s System time, in minutes
tio Total number of I/O operations
u User time, in minutes
The options to sa are:
-a List all command names, including those containing unprintable characters and those used only once. By default, sa places all names
containing unprintable characters and those used only once under the name ``***other''.
-b If printing command statistics, sort output by the sum of user and system time divided by number of calls.
-c In addition to the number of calls and the user, system and real times for each command, print their percentage of the total over all
-d If printing command statistics, sort by the average number of disk I/O operations. If printing user statistics, print the average
number of disk I/O operations per user.
-D If printing command statistics, sort and print by the total number of disk I/O operations.
-f Force no interactive threshold comparison with the -v option.
-i Do not read in the summary files.
-j Instead of the total minutes per category, give seconds per call.
-k If printing command statistics, sort by the cpu-time average memory usage. If printing user statistics, print the cpu-time average
-K If printing command statistics, print and sort by the cpu-storage integral.
-l Separate system and user time; normally they are combined.
-m Print per-user statistics rather than per-command statistics.
-n Sort by number of calls.
Use the specified file for accessing the per-command accounting summary database, instead of the default /var/account/savacct.
-q Create no output other than error messages.
-r Reverse order of sort.
-s Truncate the accounting files when done and merge their data into the summary files.
-t For each command, report the ratio of real time to the sum of user and system cpu times. If the cpu time is too small to report,
``*ignore*'' appears in this field.
Use the specified file for accessing the per-user accounting summary database, instead of the default /var/account/usracct.
-u Superseding all other flags, for each entry in the accounting file, print the user ID, total seconds of cpu usage, total memory
usage, number of I/O operations performed, and command name.
For each command used cutoff times or fewer, print the command name and await a reply from the terminal. If the reply begins with
``y'', add the command to the category ``**junk**''. This flag is used to strip garbage from the report.
By default, per-command statistics will be printed. The number of calls, the total elapsed time in minutes, total cpu and user time in min-
utes, average number of I/O operations, and CPU-time averaged core usage will be printed. If the -m option is specified, per-user statistics
will be printed, including the user name, the number of commands invoked, total cpu time used (in minutes), total number of I/O operations,
and CPU storage integral for each user. If the -u option is specified, the uid, user and system time (in seconds), CPU storage integral, I/O
usage, and command name will be printed for each entry in the accounting data file.
If the -u flag is specified, all flags other than -q are ignored. If the -m flag is specified, only the -b, -d, -i, -k, -q, and -s flags are
/var/account/acct raw accounting data file
/var/account/savacct per-command accounting summary database
/var/account/usracct per-user accounting summary database
The sa utility exits 0 on success, and >0 if an error occurs.
lastcomm(1), acct(5), ac(8), accton(8)
Chris G. Demetriou <email@example.com>
While the behavior of the options in this version of sa was modeled after the original version, there are some intentional differences and
undoubtedly some unintentional ones as well. In particular, the -q option has been added, and the -m option now understands more options
than it used to.
The formats of the summary files created by this version of sa are very different from the those used by the original version. This is not
considered a problem, however, because the accounting record format has changed as well (since user ids are now 32 bits).
The number of options to this program is absurd, especially considering that there is not much logic behind their lettering.
The field labels should be more consistent.
The VM system does not record the CPU storage integral.
May 18, 2007 BSD