sar(1M) DG/UX 4.30 sar(1M)
NAME
sa1, sa2, sadc - system activity report package
SYNOPSIS
/usr/lib/sa/sadc [t n] [ofile]
/usr/lib/sa/sa1 [t n]
/usr/lib/sa/sa2 [-ubdycwaqvmprA] [-s time] [-e time] [-i
sec]
DESCRIPTION
Sar(1M) accesses system activity data automatically on a
routine basis. Such data can also be accessed at the
special request of a user through sar(1)). The operating
system contains a number of counters that are incremented as
various system actions occur. These include CPU utilization
counters, buffer usage counters, disk and tape I/O activity
counters, TTY device activity counters, switching and
system-call counters, file-access counters, queue activity
counters, and counters for inter-process communications.
Sadc and the shell procedures sa1 and sa2 sample, save, and
process this data.
Sadc, the data collector, samples system data n times every
t seconds and writes in binary format to ofile or to
standard output. If t and n are omitted, a special record
is written. This facility is used at system boot time to
mark the time at which the counters restart from zero. The
/etc/init.d/rc.account entry:
su sys -c "/usr/lib/sa/sadc /usr/adm/sa/sa`date +%d`"
writes the special record to the daily data file to mark the
system restart.
The shell script sa1, a variant of sadc, collects and stores
data in binary file /usr/adm/sa/sadd (dd is the current
day). The arguments t and n write records n times at an
interval of t seconds; the default is to write once. The
following crontab (see cron(1M)) entries will produce
records every 20 minutes during working hours and hourly
otherwise:
0 * * * 0,6 su - sys -c "/usr/lib/sa/sa1"
0 8-17 * * 1-5 su sys -c "/usr/lib/sa/sa1 1200 3"
0 18-7 * * 1-5 su sys -c "/usr/lib/sa/sa1"
The shell script sa2, a variant of sar(1), writes a daily
report in file /usr/adm/sa/sardd. The options are explained
Licensed material--property of copyright holder(s) Page 1
sar(1M) DG/UX 4.30 sar(1M)
in sar(1). The crontab entry:
5 18 * * 1-5 su adm -c "/usr/lib/sa/sa2 -s 8:00 -e
18:01 -i 3600 -A"
reports important activities hourly during the working day.
The binary data file consists of a tblmap structure followed
by a series of sa structures, defined as follows:
struct tblmap {
char sa_magic[4]; /* a magic "number" */
short sa_revision; /* a version id */
char sa_sysname[12]; /* from the monitored system's uname struct */
char sa_nodename[12];
char sa_release[24];
char sa_version[24];
char sa_machine[24];
int sa_hertz; /* the monitored system's hertz value */
char devnm[NDEVS][25]; /* device names */
} tblmap;
#define SAMAGIC "sar"
#define SAVERSION 0430
struct sysinfo {
time_t cpu[5];
#define CPU_IDLE 0
#define CPU_USER 1
#define CPU_KERNEL 2
#define CPU_WAIT 3
#define CPU_SXBRK 4
time_t wait[3];
#define W_IO 0
#define W_SWAP 1
#define W_PIO 2
unsigned long bread;
unsigned long bwrite;
unsigned long lread;
unsigned long lwrite;
unsigned long phread;
unsigned long phwrite;
unsigned long swapin;
unsigned long swapout;
unsigned long bswapin;
unsigned long bswapout;
unsigned long pswitch;
unsigned long syscall;
unsigned long sysread;
unsigned long syswrite;
unsigned long sysfork;
unsigned long sysexec;
Licensed material--property of copyright holder(s) Page 2
sar(1M) DG/UX 4.30 sar(1M)
unsigned long runque;
unsigned long runocc;
unsigned long swpque;
unsigned long swpocc;
unsigned long iget;
unsigned long namei;
unsigned long dirblk;
unsigned long readch;
unsigned long writech;
unsigned long rcvint;
unsigned long xmtint;
unsigned long mdmint;
unsigned long rawch;
unsigned long canch;
unsigned long outch;
unsigned long msg;
unsigned long sema;
unsigned long pnpfault;
unsigned long wrtfault;
};
struct minfo {
unsigned long freemem;
unsigned long freeswap;
unsigned long vfault;
unsigned long pfault;
unsigned long file;
unsigned long freedpgs;
};
struct dinfo {
time_t serve;
};
Licensed material--property of copyright holder(s) Page 3
sar(1M) DG/UX 4.30 sar(1M)
struct sa {
struct sysinfo si; /* system statistics */
struct minfo mi; /* memory and paging statistics */
struct dinfo di; /* (not used) */
unsigned int minserve; /* (not used) */
unsigned int maxserve; /* (not used) */
unsigned int szinode; /* current entries of inode table */
unsigned int szfile; /* current entries of file table */
unsigned int szproc; /* current entries of proc table */
unsigned int szlckf; /* current size of file record header table */
unsigned int szlckr; /* current size of file record lock table */
unsigned int mszinode; /* max size of inode table */
unsigned int mszfile; /* max size of file table */
unsigned int mszproc; /* max size of proc table */
unsigned int mszlckf; /* max size of file record header table */
unsigned int mszlckr; /* max size of file record lock table */
unsigned long inodeovf; /* cumul. overflows of inode table */
unsigned long fileovf; /* cumul. overflows of file table */
unsigned long procovf; /* cumul. overflows of proc table */
time_t ts; /* time stamp, seconds */
int apstate; /* number of processors */
unsigned long devio[NDEVS][4]; /* device info for up to NDEVS units */
#define IO_OPS 0 /* cumul. I/O requests */
#define IO_BCNT 1 /* cumul. blocks transferred */
#define IO_ACT 2 /* cumul. drive active time in ticks */
#define IO_RESP 3 /* cumul. I/O resp time in ticks */
};
Note that not all elements of all structures are used by the
DG/UX implementation of sar.
FILES
/usr/adm/sa/sadd Daily data file
/usr/adm/sa/sardd Daily report file
SEE ALSO
cron(1M), sar(1), timex(1).
Licensed material--property of copyright holder(s) Page 4