SA(8) | 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 system,
/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
cp
cpu
cp
k
k*sec
re
s
tio
u
The options to sa
are:
-a
sa
places
all names containing unprintable characters and those used only once under
the name ``***other''.-b
-c
-d
-D
-f
-v
option.-i
-j
-k
-K
-l
-m
-n
-P
file-q
-r
-s
-t
-U
file-u
-v
cutoffBy default, per-command statistics will be printed. The number of
calls, the total elapsed time in minutes, total cpu and user time in
minutes, 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
honored.
The sa
utility exits 0 on success,
and >0 if an error occurs.
sa
first appeared in
Version 5 AT&T UNIX.
sa
was rewritten for NetBSD
0.9A from the specification provided by various systems' manual
pages.
Chris G. Demetriou <cgd@postgres.berkeley.edu>
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.
February 14, 2020 | macOS 15.0 |