.TH sa "" "" Command
.PC "Print a summary of process accounting"
\fBsa [\-abcjlmnrstu] [\-v \fIN\^\fB] [\fIfile\^\fB]\fR
.PP
.HS
.SH Options:
.IC \fB\-a\fR
Commands seen once or unprintable called \fB***other\fR
.IC \fB\-b\fR
Sort by average CPU time per call
.IC \fB\-c\fR
Print CPU time as percentage of all CPU time used
.IC \fB\-j\fR
Print average times per call, not totals
.IC \fB\-l\fR
Separate user and system times
.IC \fB\-m\fR
Information per user, not per command
.IC \fB\-n\fR
Sort by number of calls
.IC \fB\-r\fR
Reverse sort
.IC \fB\-s\fR
Condense the information
.IC \fB\-t\fR
Print CPU time as percentage of real time
.IC \fB\-u\fR
Print user and command directly from raw file
.IC \fB\-v\fIN\fR
If called no more than \fIN\fR times, put it into \fB**junk**\fR
.Pp
The default \fIfile\fR is \fB/usr/adm/acct\fR.
.HE
One of the accounting mechanisms available on the \*(CO system is
.I "process accounting"
(also called
.IR "shell accounting" ),
which records the commands executed by each user.
The command
.B accton
enables or disables shell accounting.
.PP
The command
.B sa
scans
the accounting information in
.I file
and prints a summary.
If
.I file
is omitted, it reads the file
.B /usr/adm/acct
by default.
For each command executed,
.B sa
prints the number of calls made, the total CPU time (user and system),
and the total real time.
The output is ordered by decreasing CPU time.
.PP
.B sa
recognizes the following options:
.RS
.IP \fBa\fR 0.4i
Place commands executed only once and command names with unprintable
characters in the category \*(QL***other\*(QR.
.IP \fBb\fR
Sort by average CPU time per call.
.IP \fBc\fR
Also print CPU time as a percentage of all CPU time used.
.IP \fBj\fR
Print average times per call rather than totals.
.IP \fBl\fR
Separate user and system time.
.IP \fBm\fR
Accumulate information for each user rather for each command.
.IP \fBn\fR
Sort by number of calls.
.IP \fBr\fR
Reverse the order of the sort.
.IP \fBs\fR
After scanning,
condense the accounting file and merge it into the summary files.
.IP \fBt\fR
Also print the CPU time as a percentage of real time.
.IP \fBu\fR
Print the user and command for each accounting record;
this option overrides all others.
.IP "\fBv \fIN\fR"
For commands called no more than
.I N
times, where
.I N
is a digit,
.B sa
asks whether to place the command in the category ``**junk**''.
.RE
.PP
.B sa
uses the summary files
.B /usr/adm/savacct
and
.B /usr/adm/usracct
to lessen disk usage.
.SH Files
\fB/usr/adm/acct\fR \(em Default account data
.br
\fB/usr/adm/savacct\fR \(em Summary
.br
\fB/usr/adm/usracct\fR \(em Summary
.SH "See Also"
.Xr "ac," ac
.Xr "acct()," acct
.Xr "acct.h," acct.h
.Xr "accton," accton
.Xr "commands" commands
.SH Notes
The file
.B /usr/adm/acct
can become very large; therefore, you should
truncate it periodically.
Special care should be taken if process accounting is enabled on a
\*(CO system with limited disk space.
