[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


sa Command

Purpose

Summarizes accounting records.

Syntax

/usr/sbin/sa -a ] [  -b ] [  -c ] [ -C ][  -d ] [  -D ] [ -i ] [  -j ] [  -k ] [  -K ] [  -l ] [  -m] [  -n ] [  -r ] [  -s ] [  -t ] [  -u ] [  -vNumber -f ] ] [  -SSaveFile ] [  -UUserFile ] [ File ... ]

Description

The sa command summarizes the information in the file that collects the raw accounting data, either the /var/adm/pacct file or the file specified by the File parameter, and writes a usage summary report to the /var/adm/savacct file. Then, the sa command deletes the data in the /var/adm/pacct file so it can collect new accounting information. The next time the sa command executes, it reads the usage summary and the new data and incorporates all the information in its report.

The flags used with the sa command vary the type of information that is reported. The reports can contain the following fields:

avio Indicates the average number of I/O operations per execution.
cpu Indicates the sum of user and system time (in minutes).
k Indicates the average K-blocks of CPU-time per execution.
k*sec Indicates the CPU storage integral in kilo-core seconds.
re Indicates the minutes of real time.
s Indicates the minutes of system CPU time.
tio Indicates the total number of I/O operations.
u Indicates the minutes of user CPU time.

If you run the sa command without specifying any flags, the summary report includes the number of times each command was called as well as the re, cpu, avio, and k fields.

Note: The -b, -d, -D, -k, -K, and -n flags determine how output is sorted. If you specify more than one of these flags on the command line, only the last one specified will take effect.

Summary files created under this release of the base operating system are saved in a format that supports large user IDs (8 characters or longer). Summary files created under previous releases may be in the old format that supports only user IDs of up to 7 characters. The sa command recognizes and supports both formats of the summary file. If you need to convert old format summary files to the new format, use the -C flag instead of the -s flag. You need to do this conversion only once. After converting you can use either the -s or the -C flag.

Flags


-a Prints all command names, including those with unprintable characters. Commands that were used once are placed under the other category.
-b Sorts output by the sum of user and system time divided by the number of calls. Otherwise, output is the sum of user and system time.
-c Prints the time used by each command as a percentage of the time used by all the commands. This is in addition to the user, system and real time.
-C Merges the accounting file into the summary file. If the summary file is in the old format, it is converted into the new format.
-d Sorts the output by the average number of disk I/O operations.
-D Sorts and prints the output by the total number of disk I/O operations.
-f Does not force interactive threshold compression. This flag must be used with the -v flag.
-i Reads only the raw data, not the summary file.
-j Prints the number of seconds per call instead of the total minutes per category.
-k Sorts the output by the average CPU time.
-K Sorts and prints the output by the CPU-storage integral.
-l Separates system and user time, instead of combining them.
-m Prints the number of processes and the number of CPU minutes for each user.
-n Sorts output by the number of calls.
-r Reverses the order of the sort.
-s Merges the accounting file into the summary file.
-S SaveFile Uses the specified saved file as the command summary file, instead of the /var/adm/savacct file.
-t Prints the ratio of real time to the sum of user and system time for each command.
-u Suspends all other flags and prints the user's numeric ID and the command name for each command.
-U UserFile Uses the specified file instead of the /var/adm/usracct file to accumulate the per-user statistics printed by the -m flag.
-v Number Types the name of each command used the specified number times or fewer. When queried, if you type y (yes), the command is added to the junk category and appears in future summaries as part of that category.

Examples

  1. To summarize accounting records for all the commands in the /var/adm/pacct file, enter:
    sa  -a
    Commands used only once are placed under the other field.
  2. To summarize accounting records by average CPU time, enter:
    sa -k

Files


/usr/sbin/sa Contains the sa command.
/etc/sa Contains the symbolic link to the sa command.
/var/adm/pacct Contains raw accounting records.
/var/adm/savacct Contains summary accounting records.
/var/adm/usracct Contains summary accounting records by user.

Related Information

The acctcms command, acctcom command, acctcon1 or acctcon2 command, acctmerg command, acctprc1, acctprc2, or accton command, fwtmp command, runacct command.

For more information about the Accounting System, the preparation of daily and monthly reports, and the accounting files, see the Accounting Overview in the AIX 5L Version 5.1 System Management Concepts: Operating System and Devices.

Setting Up an Accounting System in the AIX 5L Version 5.1 System Management Guide: Operating System and Devices describes the steps you must take to establish an accounting system.

See the Accounting Commands in the AIX 5L Version 5.1 System Management Concepts: Operating System and Devices for a list of accounting commands that can be run automatically or entered from the keyboard.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]