sar(8) CLIX sar(8)
NAME
sar, sa1, sa2, sadc - Runs the system activity reporter
SYNOPSIS
/usr/lib/sa/sadc [t n] [ofile]
/usr/lib/sa/sa1 [t n]
/usr/lib/sa/sa2 [-ubdycwaqvmprDSAC] [-s time] [-e time] [-i sec]
FLAGS
The sar command contains the following flags:
-u Reports CPU utilization (the default). This flag reports : %usr,
%sys, %wio, %idle - portion of time running in the user mode, running
in system mode, idle with some process waiting for block I/O, and
otherwise idle. When used with -D, %sys is split into the percent of
time servicing requests from remote machines (%sys remote) and all
other system time (%sys local).
-b Reports buffer activity, including: bread/s, bwrit/s - transfers per
second of data between system buffers and disk or other block
devices; lread/s, lwrit/s - accesses of system buffers; %rcache,
%wcache - cache hit ratios, that is, (1-bread/lread) as a percentage;
pread/s, pwrit/s - transfers with raw (physical) device mechanism.
When used with -D, buffer caching is reported for locally-mounted
remote resources.
-d Reports activity for each block device, for example, disk or tape
drive. When data is displayed, the device specification dsk- is
generally used to represent a disk drive. The device specification
used to represent a tape drive is machine dependent. The activity
data reported is: %busy, avque - portion of time device was busy
servicing a transfer request, average number of requests outstanding
during that time; r+w/s, blks/s - number of data transfers from or to
device, number of bytes transferred in 512-byte units;
avwait, avserv - average time in ms. that transfer requests wait
idly on queue, and average time to be serviced (which for disks
includes seek, rotational latency and data transfer times).
-y Reports TTY device activity: rawch/s, canch/s, outch/s - input
character rate, input character rate processed by canon, output
character rate; rcvin/s, xmtin/s, mdmin/s - receive, transmit and
modem interrupt rates.
-c Reports system calls:
2/94 - Intergraph Corporation 1
sar(8) CLIX sar(8)
scall/s - system calls of all types;
sread/s, swrit/s, fork/s, exec/s - specific system calls;
rchar/s, wchar/s - characters transferred by read and write system
calls. When used with -D, the system calls are split into incoming,
outgoing, and strictly local calls.
-w Reports system swapping and switching activity:
swpin/s, swpot/s, bswin/s, bswot/s - number of transfers and number
of 512-byte units transferred for swapins and swapouts (including
initial loading of some programs);
pswch/s - process switches.
-a Reports use of file access system routines:
iget/s, namei/s, dirblk/s.
-q Reports average queue length while occupied, and % of time occupied:
runq-sz, %runocc - run queue of processes in memory and runnable;
swpq-sz, %swpocc - swap queue of processes swapped out but ready to
run.
-v Reports status of process, inode, file tables:
text-sz, proc-sz, inod-sz, file-sz, lock-sz - entries/size for each
table, evaluated once at sampling point;
ov - overflows that occur between sampling points for each table.
-m Reports message and semaphore activities:
msg/s, sema/s - primitives per second.
-p Reports paging activities:
vflt/s - address translation page faults (valid page not in memory);
pflt/s - page faults from protection errors (illegal access to page)
or ``copy-on-writes'';
pgfil/s - vflt/s satisfied by page-in from file system;
rclm/s - valid pages reclaimed for free list.
-r Reports unused memory pages and disk blocks:
2 Intergraph Corporation - 2/94
sar(8) CLIX sar(8)
freemem - average pages available to user processes;
freeswap - disk blocks available for process swapping.
-D Reports Remote File Sharing activity:
When used in combination with -u, -b or -c, it causes sar to produce
the remote file sharing version of the corresponding report. -Du is
assumed when only -D is specified.
-S Reports server and request queue status:
Average number of Remote File Sharing servers on the system
(serv/lo-hi), % of time receive descriptors are on the request queue
(request %busy), average number of receive descriptors waiting for
service when queue is occupied (request avg lgth), % of time there
are idle servers (server %avail), average number of idle servers when
idle ones exist (server avg avail).
-A Reports all data. Equivalent to -udqbwcayvmprSDC.
-C Reports Remote File Sharing buffer caching overhead:
snd-inv/s - number of invalidation messages per second sent by your
machine as a server.
snd-msg/s - total outgoing RFS messages sent per second.
rcv-inv/s - number of invalidation messages received from the remote
server.
rcv-msg/s - total number of incoming RFS messages received per
second.
dis-bread/s - number of buffer reads that would be eligible for
caching if caching were not turned off. (Indicates the penalty of
running uncached.)
blk-inv/s - number of buffers removed from the client cache.
DESCRIPTION
The sar command allows users to access system activity data. A number of
flags are included in this command, allowing the user to specify the type
of system activity to be reported.
Before using the sar command the first time after it has been loaded onto
a system, a sar control script named perf must be initialized by the
superuser with the following command. After running this command once,
the files needed by sar to run will be automatically invoked each time the
system boots:
2/94 - Intergraph Corporation 3
sar(8) CLIX sar(8)
# /etc/init.d/perf init
System activity data can be accessed automatically and at the special
request of a user on a function basis as described here. The operating
system contains a number of counters that are incremented as various
system actions occur. These include counters for utilization, buffer
usage, disk and tape activity, device activity, switching and system-call
activity, file-access, queue activity, inter-process communications,
paging and Remote File Sharing.
The sadc command and shell procedures, sa1 and sa2, are used to sample,
save, and process this data.
The sadc command is a data collector which samples system data n times,
with an interval of t seconds between samples and writes in binary format
to ofile or to stdout. If t and n are omitted, a special record is
written. This facility is used at system boot time, when booting to a
multiuser state to mark the time at which the counters restart from zero.
The shell script sa1, a variant of sadc, is used to collect and store data
in the binary file /usr/adm/sa/sa dd. Here, dd is the current day. The
arguments t and n cause records to be written n times at an interval of t
seconds, or once if omitted.
The shell script sa2, a variant of sar, writes a daily report in file
/usr/adm/sa/sar dd. The flags are explained in the sar command.
Following is a sample /usr/spool/cron/crontabs/sys entry:
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
This entry will report important activities hourly during the working day.
The structure of the binary daily data file is:
struct sa {
struct sysinfo si; /* see /usr/include/sys/sysinfo.h */
struct minfo mi; /* defined in sys/sysinfo.h */
struct dinfo di; /* RFS info defined in sys/sysinfo.h */
int minserve, maxserve; /* RFS server low and high water marks */
int szinode; /* current size of inode table */
int szfile; /* current size of file table */
int szproc; /* current size of proc table */
int szlckf; /* current size of file record header table */
int szlckr; /* current size of file record lock table */
int mszinode; /* size of inode table */
int mszfile; /* size of file table */
int mszproc; /* size of proc table */
int mszlckf; /* maximum size of file record header table */
int mszlckr; /* maximum size of file record lock table */
long inodeovf; /* cumulative overflows of inode table */
4 Intergraph Corporation - 2/94
sar(8) CLIX sar(8)
long fileovf; /* cumulative overflows of file table */
long procovf; /* cumulative overflows of proc table */
time_t ts; /* time stamp, seconds */
long devio[NDEVS][4]; /* device unit information */
#define IO_OPS 0 /* cumulative I/O requests */
#define IO_BCNT 1 /* cumulative blocks transferred */
#define IO_ACT 2 /* cumulative drive busy time in ticks */
#define IO_RESP 3 /* cumulative I/O resp time in ticks */
};
EXAMPLES
1. The following example, taken from the /etc/init.d/perf file, writes
the restart mark to the daily data:
su sys -c /usr/lib/sa/sadc /usr/adm/sa/sa`date +%d`
2. The following example, from /usr/spool/cron/crontabs/sys (see the cron
command), will produce records every 20 minutes during working hours
and hourly otherwise:
0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
3. This example, from /usr/spool/cron/crontabs/sys, will report important
activities hourly during the working day:
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
FILES
/usr/adm/sa/sadd Daily data file
/usr/adm/sa/sardd Daily report file
/tmp/sa.adrfl Address file
CAUTIONS
Since the sadc command depends on the operating system kernel, it may
generate console error messages and/or provide incorrect information if
used with a kernel from a different release. Also, errors may occur
between the time a kernel is downloaded and when it is activated through a
reboot.
DIAGNOSTICS
2/94 - Intergraph Corporation 5
sar(8) CLIX sar(8)
The following error message may appear on the console if the sadc command
is used with a kernel from a different release, or if the kernel you
booted from is not /unix:
NOTICE: growreg (/usr/lib/sa/sadc 1 1 ...) - Insufficient memory to
allocate <#> pages.
EXIT VALUES
The sadc command will exit with a nonzero value if it encounters a
problem.
RELATED INFORMATION
Commands: cron(8), sag(1), sar(1), timex(1)
6 Intergraph Corporation - 2/94