HP-UX Reference (11i v2 07/12) - 1M System Administration Commands N-Z (vol 4)
s
sa1(1M) sa1(1M)
NAME
sa1, sa2, sadc - system activity report package
SYNOPSIS
/usr/lbin/sa/sa1
[tn]
/usr/lbin/sa/sa2
[-ubdycwaqvmA ][-s time ][-e
time ][-i sec ]
/usr/lbin/sa/sadc
[tn][ofile ]
DESCRIPTION
System activity data can be accessed at the special request of a user (see sar(1M)) and automatically on a
routine basis as described here. 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 shell procedures sa1 and sa2
are used to 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. Executing the following command in a
system startup script:
/usr/lbin/sa/sadc /var/adm/sa/sa‘date +%d‘
writes the special record to the daily data file to mark the system restart. Instructions for creating system
startup scripts may be found in the 10.0 File System Layout White Paper, which is online in file
/usr/share/doc/filesys.ps
.
The shell script
sa1, a variant of sadc, is used to collect and store data in binary file
/var/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 following entries, if placed in
crontab, produce
records every 20 minutes during working hours and hourly otherwise (see cron(1M)):
0 * * * 0,6 /usr/lbin/sa/sa1
0 8-17 * * 1-5 /usr/lbin/sa/sa1 1200 3
0 18-7 * * 1-5 /usr/lbin/sa/sa1
The shell script sa2, a variant of sar, writes a daily report in file
/var/adm/sa/sardd. The options
are explained in sar(1M). The following
crontab entry reports important activities hourly during the
working day:
5 18 * * 1-5 /usr/lbin/sa/sa2 -s 8:00 -e 18:01 -i 3600 -A
Structure of the binary daily data file lists information about the active processors. The structure of the
binary daily data file is:
struct sa {
unsigned long version[PST_MAX_CPUSTATES]; /* sadd file version */
psetid_t psetid[SAR_MAX_PROCS][2]; /* mapping of psetid
and cpus in the
system */
int cpus[SAR_MAX_PROCS]; /* Active processors list */
unsigned long cpu [PST_MAX_CPUSTATES]; /* Average time spent in
each state */
unsigned long mp_cpu [SAR_MAX_PROCS][PST_MAX_CPUSTATES];
/* per proc cpu time */
unsigned long proc_cnt; /* MP: number of active processors */
unsigned long max_proc_cnt; /* MP: max active processors */
unsigned long ndrives; /* Number of drives */
unsigned long bread; /* Transfer of data between system
buffers and disk or other block devices */
unsigned long bwrite;
unsigned long lread; /* Access of system buffers */
HP-UX 11i Version 2: December 2007 Update − 1 − Hewlett-Packard Company 277