sa(8) System Manager's Manual sa(8)
NAME
sa - Summarizes accounting records
SYNOPSIS
sa [-abcdDfijkKlmnorstu] [-v Number] [-S SaveFile] [-U UserFile] [File] The sa command helps you manage the large volume of accounting
information that is generated each day when system accounting has been enabled by the system administrator or by the superuser.
FLAGS
Outputs all command names (including those containing unprintable characters and commands used only once) in the last column. In the
default format, such commands are summed and the total is written as the entry ***other. Sorts cpu output column 3 according to the sum of
user and system CPU time divided by the amount of CPU time required to execute the command entered in the last column (6) as many times as
is entered in the first column (1). Adds three percentage columns to the default format to list percentages as follows: Lists the percent-
age of the number of times each command was executed with respect to the total number of times all commands were executed (see 1a below).
Lists the percentage of the amount of real time required to execute each command the number of times entered in the first column with
respect to the total real time required to execute the total of all commands entered in the last column (see 2a below). Lists the percent-
age of the amount of command CPU time required to execute each command the number of times entered in the first column with respect to the
total CPU time required to execute the total of all commands entered in the last column (see 3a below). Sorts avio output column (4) in
descending order according to the average number of disk I/O operations. Substitutes tio column (4a) for the avio (4) column and sorts tio
output column 4a in descending order according to the total number of disk I/O operations. Used with the -v flag to inhibit interactive
threshold comparison of commands. Reads raw database file /var/adm/pacct only. Does not include records from summary database file
/var/adm/savacct. Outputs the average number of seconds per command in default columns 2, 3, and 4 instead of the total time in minutes
for the number of calls entered in column 1 for each command. Sorts and outputs records according to the value in the k output column 5 in
descending order. Substitutes k*sec column (5a) for the k (5) column and sorts the k*sec output column in descending order according to
the value of the memory time integral. Separates cpu column 3 into two columns. The new column entries are column 3a, which lists the s
(system) part of the CPU minutes, and column 3b, which lists the u (user) part of the CPU minutes. Outputs a 5-column file, which provides
the information in the following table. Listed below in left-to-right order are the column identification suffixes, or none when no suffix
is used, and the purpose of the column. Some columns are identical to the default output format described in the table in the DESCRIPTION
section; these are marked with *. Username or user ID as written in the /etc/passwd file. The total number of processes executed by the
user during the accounting period. Same as column 3 in the default output file. Same as column 4a in the default output file. Same as
column 5a in the default output file. Outputs the default format sorted in descending order according to the number of times each command
was called. Substitutes, in the default output format, the ratio of user CPU time (u) to system CPU time (s) as u/s in column 3 in place
of the total user and system CPU time (cpu) for the number of calls entered in the first column. The default format, described under
Description, is resorted in ascending order according to the values entered in column 3, cpu time. This sort is the reverse of the default
sort. Merges information in accounting database file /var/adm/pacct with summary files you specify with the -U and -S flags, or merges the
database file information with information in default files /var/adm/usracct or /var/adm/savacct. After the merge, database file
/var/adm/pacct is truncated. The use of this flag also implies the use of the -a flag. Uses SaveFile as the command summary file in place
of file /var/adm/savacct. Adds the re/cp column (3d) to the default format. Entries in this column express the ratio of real time to total
(cpu) time, which is the sum of user and system time for each command entered in the last column. Suspends all other flags and prints the
user numeric ID, the CPU time, memory usage, number of I/O operations, and the command name for each command. Uses UserFile as the user
summary file in place of file /var/adm/usracct to record per-user statistics output with the -m flag. Prints, as a query, the name of each
command used Number times or fewer to the standard output as follows: command-- where command-- is the name of the command written to the
standard output by sa.
When you respond by typing y to the standard input, the command record is omitted from a default-formatted list at the end of the interac-
tive command queries written to the standard output. The columnar values of the omitted record are totaled in an added record whose command
name is **junk** in the last column of that list. When you type any other character, the record for the queried command name remains in the
default output list at the end of the interactive commands written to the standard input.
DESCRIPTION
When you use the -s flag with the sa command, the information in /var/adm/pacct is condensed into summary file /var/adm/savacct, which con-
tains a count of the number of times each command was called and the amount of time system resources were used.
Condensed information for each user is stored in /var/adm/usracct. This condensed-information file conserves storage space because on a
large system the /var/adm/pacct daily process file can grow by as many as 100 blocks per day. Summary files are normally read before
accounting files are, so that files produced by sa include all available information.
When a filename is given as the last argument, the named file is treated as the process accounting file. The /var/adm/pacct file is the
default process accounting file.
When the sa command is invoked with no flags, the default output summary is an unheaded 6-column file consisting of, in some cases, infor-
mation having an identification suffix in the column. The identification suffix may be changed from the default (no flags specified) output
format by using various flags.
The following table lists the columns with left-to-right reference column numbers (not included in output) for the default format on the
left, the identification suffix for the entry when one is used (or none when one is not in the middle), and the purpose of the information
in that column on the right.
Columns having more than one identification suffix description (2 and 2a, for example) use the alternate suffix designation in the same sa
output printout column for each of the listed alternate entries for the column. For example, the second column has two possible suffix
designations: re and %. The re reference in the middle column describes the information in the second column of the output printed by the
sa command when this suffix is used. Correspondingly, the % reference describes the information in the sa output when the % suffix is used.
1 none The number of times the command entered in the last column
(6) was called.
1a % When the -c flag is used, sa adds this column after column 1
to list the number of times the command was called (entered
in column 1) as a percentage of the total number of times all
commands entered in the last column were called.
2 re The number of real-time (elapsed) minutes required to execute
the command entered in the last column (6) as many times as
is entered in the first column (1).
2a % When the -c flag is used, sa also adds this column after col-
umn 2 to list the amount of real time (entered in column 2)
required to process the command entered in the last column
(6) as many time as is entered in the first column (1), as a
percentage of the total amount of real time required to
process all of the commands listed in the last column.
3 cpu The number of CPU (user plus system) minutes used to execute
the command entered in the last column (6) as many times as
is entered in the first column (1).
3a u The number of user CPU minutes used.
3b s The number of system CPU minutes used.
3c u/s When the -o flag is used, substitutes u/s column (3c) for the
cpu (3) column and sorts the u/s output column in descending
order according to the ratio of user CPU time to system CPU
time.
3d % When the -c flag is used, sa also adds this column after col-
umn 3 to list the amount of CPU time (entered in column 3)
required to process the command, entered in the last column,
the number of times, entered in the first column, as a per-
centage of the total CPU time required to process all of the
commands listed in the last column.
3e re/cpu When the -t flag is used, adds the re/cpu column to the
default output format. Entries in this column express the
ratio of real CPU process time to total CPU time (cpu), which
includes user and system time. These entries appear after
entries for the cpu (3) column. The default output sort
remains unchanged.
4 avio The average number of input/output operations for each listed
command.
4a tio The total number of input/output operations for each listed
command.
5 k The average number of kiloblocks (blocks x 1024) of memory
used for each command process.
5a k*sec CPU storage-time integral in K-core seconds (seconds x 1024).
6 none The command name (a trailing * [asterisk] indicates a forked
program).
Other considerations for entries in the printed sa output are as follows: All times are expressed to nearest one hundredth. The default
format is sorted in descending order according to the values entered in column 3, cpu time. You should not share accounting files among
nodes in a distributed environment. Each node should have its own copy of the various accounting files. When you are also using
/usr/sbin/acct/* accounting commands, do not delete accounting records in the /var/adm/pacct process accounting source file because these
records also provide information for summary data files when the -s option is used.
EXAMPLES
To summarize accounting records for all commands entered in the /var/adm/pacct process database file, enter: sa -a Commands used only
once are summed with the entry ***other in the last column of the default output format. To summarize accounting records according to the
average number of kiloblocks of memory used for each command, enter: sa -k
FILES
Specifies the command path Process accounting database file. System process accounting summary file. User process accounting summary
file.
RELATED INFORMATION
Commands: acct(8), acctcms(8), acctcom(8), acctcon(8), acctmerg(8), acctprc(8), fwtmp(8), runacct(8) delim off
sa(8)