sar(ADM) 06 January 1993 sar(ADM) Name sar, sa1, sa2, sadc - system activity report package Syntax sar [ -aBbcdghmnpqRruvwy ] [ -A ] [ -o file ] t [ n ] sar [ -aBbcdghmnpqRruvwy ] [ -A ] [ -s time ] [ -e time ] [ -i sec ] [ -f file] /usr/lib/sa/sadc [ t n ] [ ofile ] /usr/lib/sa/sa1 [ t n ] /usr/lib/sa/sa2 [ -ubdycwaqvmnprRBgh ] [-s time ] [-e time ] [-i sec ] Description sar, in the first instance, samples cumulative activity counters in the operating system at n intervals of t seconds, where t should be 5 or greater. If the -o option is specified, it saves the samples in a file in binary format. The default value of n is 1. In the second instance, with no sampling interval specified, sar extracts data from a previously recorded file, either the one specified by the -f option or, by default, the standard system activity daily data file /usr/adm/sa/sadd for the current day dd. The start and end times of the report can be bounded via the -s and -e time arguments in the form hh[:mm[:ss]]. The -i option selects records at sec second intervals. Otherwise, all intervals found in the data file are reported. Any information that is displayed ``per second'' is the average over the interval t. Each of these values is calculated as the total number of occurrences of the event, over the duration of the interval t, divided by the interval t. The options that can be used with sar are: -A This is equivalent to specifying all the options that do not require arguments. -a Report use of file access system routines: iget/s, namei/s, dirblk/s. -B Report additional buffer cache activity: cpybuf/s -- number of copy buffers required per second; slpcpybuf/s -- number of times necessary to sleep waiting for a copy buffer. -b Report buffer activity: 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 via raw (physical) device mechanism. -c Report system calls: 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. -d Report 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 milliseconds, that transfer requests wait idly on queue, and average time to be serviced (which for disks includes seek, rotational latency, and data transfer times). -g Report on serial I/O: ovsiohw/s -- overflows at sio hardware; ovsiodma/s -- overflows at sio dma cache; ovclist/s -- overflows of clists. -h Report buffer statistics: mpbuf/s -- number of mp (scatter-gather) buffers allocated per second; ompb/s -- number of times system ran out of mp (scatter-gather) buffers per second; mphbuf/s -- number of mp (scatter-gather) buffer headers allocated per second; omphbuf/s -- number of times system ran out of mp (scatter-gather) buffer headers per second; pbuf/s -- number of physio buffers allocated per second; spbuf/s -- number of sleeps/s waiting for physio buffers per second; dmabuf/s -- number of dma transfer buffers allocated per second; sdmabuf/s -- number of sleeps/s waiting for dma transfer buffers per second. -m Report message and semaphore activities: msg/s, sema/s -- primitives per second. -n Report name cache statistics. The activity reported is: chits, cmisses -- number of name cache hits and misses; hit% -- the hit ratio as a percentage. -p Report paging activities: vflt/s -- address translation page faults (valid page not in mem- ory); pflt/s -- page faults from protection errors (illegal access to page) or ``copy-on-writes''; pgfil/s -- vflt/s satisfied by page-in from filesystem; rclm/s -- valid pages reclaimed for free list. -q Report 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. -R Report on process activity: dptch/s -- number of times the dispatcher is run; idler/s -- number of times the idler is run per second; swtdle/s -- number of times idler is switched to per second. -r Report unused memory pages and disk blocks: freemem -- average pages available to user processes; freeswap -- disk blocks available for process swapping. -u Report CPU utilization (the default): %usr, %sys, %wio, %idle portion of time running in user mode, run- ning in system mode, idle with some process waiting for block I/O, and otherwise idle. -v Report status of process, inode, file tables: 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. -w Report 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. -y Report 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. Data gathering The operating system contains several counters that are incremented as various system actions occur. These include counters for CPU utiliza- tion, buffer usage, disk and tape I/O activity, TTY device activity, switching and system-call activity, file-access, queue activity, inter- process communications and paging. sadc and shell procedures, sa1 and sa2, are used to sample, save, and process this data. sadc, the data collector, samples system data n times, with an interval of t seconds between samples, and writes in binary format to ofile or to standard output. The sampling interval t should be greater than 5 seconds; otherwise, the activity of sadc itself may affect the sample. 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. For example, the /etc/init.d/perf file writes the restart mark to the daily data by the command entry: su sys -c "/usr/lib/sa/sadc /usr/adm/sa/sa`date +%d`" The shell script sa1, a variant of sadc, is used to collect and store data in binary file /usr/adm/sa/sadd where 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 entries in /usr/spool/cron/crontabs/root (see cron(C)): 0 * * * 6,0 /usr/lib/sa/sa1 3600 0 8-17 * * 1-5 /usr/lib/sa/sa1 3600 0 8-17 * * 1-5 /usr/lib/sa/sa1 1200 3 will produce records every 20 minutes during working hours and hourly otherwise. The shell script sa2, a variant of sar, writes a daily report in file /usr/adm/sa/sardd. The /usr/spool/cron/crontabs/root entry: 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A will report important activities hourly during the working day. Exit values sar exits with 0 upon successful completion. It exits with value 2 if an invalid option is specified. It exits with value 1 for all other errors. Diagnostics sar: Incompatible start and end times specified (etime <= stime) Start and end times have been specified but the end time is the same as or before the end time. sar: Time step and/or number of steps requested are invalid The time interval or number of intervals specified are not integer values, are negative values or are otherwise invalid. sar: Can't open filename The input file specified with the -f option cannot be opened. sar: ofile same as ffile The specified input and output files are identical. sar: argument -- illegal argument for option option The argument specified for option is invalid. Examples To see today's CPU activity so far: sar To watch CPU activity evolve for 10 minutes and save data: sar -o temp 60 10 To later review disk and tape activity from that period: sar -d -f temp Warning Running multiple copies of sar(ADM) can affect the results. Data collec- tion is performed automatically by the kernel and is extracted using sar. It is the extraction process, not the collection that consumes resources, therefore results produced when running multiple copies might not reflect the actual performance of the system. The current version of sar is compatible with older versions of sar. Any data files saved with older versions can be read with the current ver- sion. Files /usr/bin/sar command /usr/adm/sa/sadd.num daily data file /usr/adm/sa/sardd.num daily report file /usr/lib/sa/sa.adrfl address file See also sag(ADM), timex(ADM) On MPX systems, see also mpsar(MP), cpusar(MP) Standards conformance sa1, sa2, sadc and sar are conformant with AT&T SVID Issue 2.