The sar command can be used either to gather system activity data itself or to report what has been collected in the daily activity files created by sadc.
The sar command has the following formats:
sar [-aAbcdgkmpqruvwy] [-o file] t [n] |
sar [-aAbcdgkmpqruvwy] [-s time] [-e time] [-i sec] [-f file] |
The sar command below samples cumulative activity counters in the operating system every t seconds, n times. (t should be 5 seconds or greater; otherwise, the command itself may affect the sample.) You must specify a time interval between which to take the samples; otherwise, the command operates according to the second format. The default value of n is 1. The following example takes two samples separated by 10 seconds. If the -o option is specified, samples are saved in file in binary format.
$ sar -u 10 2 |
Other important information about the sar command:
With no sampling interval or number of samples specified, sar extracts data from a previously recorded file, either the one specified by the -f option or, by default, the standard daily activity file, /var/adm/sa/sadd, for the most recent day.
The -s and -e options define the starting and ending times for the report. Starting and ending times are of the form hh[:mm[:ss]] (where h, m, and s represent hours, minutes, and seconds).
The -i option specifies, in seconds, the intervals between record selection. If the -i option is not included, all intervals found in the daily activity file are reported.
The table below lists the sar options and their actions.
Table 36-21 Options for sar Command
Option |
Actions |
---|---|
-a |
Checks file access operations |
-b |
Checks buffer activity |
-c |
Checks system calls |
-d |
Checks activity for each block device |
-g |
Checks page-out and memory freeing |
-k |
Checks kernel memory allocation |
-m |
Checks interprocess communication |
-p |
Checks swap and dispatch activity |
-q |
Checks queue activity |
-r |
Checks unused memory |
-u |
Checks CPU utilization |
-nv |
Checks system table status |
-w |
Checks swapping and switching volume |
-y |
Checks terminal activity |
-A |
Reports overall system performance (same as entering all options) |
If no option is used, it is equivalent to calling the command with the -u option.