sar Command
  
  
  Purpose
  
  Collects, reports, or saves system activity information.
  
   Syntax
  
  /usr/sbin/sar [ {  -A | [  -a ] [  -b ] [  -c ] [  -k ] [  -m ]
  [  -q ] [  -r ] [  -u ] [  -v ] [  -w ] [  -y ] } ] [  -e
  hh [ :mm [ :
  ss ] ] ] [  -fFile ] [  -iSeconds ] [  -oFile ]
  [  -shh [ :mm [ :ss ] ] ] [ Interval [ Number ] ]
  
  Description
  
  The sar command writes to standard output the contents of select-
  ed cumulative activity counters in the operating system.  The ac-
  counting system, based on the values in the Number and Interval
  parameters,  writes  information the specified  number  of  times
  spaced at the  specified  intervals in seconds.  The default sam-
  pling interval for the Number parameter is 1 second.  The col-
  lected data can also be saved in the file specified by the -o
  File flag.
  
  The sar command extracts and writes to standard output records
  previously saved in a file.  This  file  can  be  either  the one
  specified by the -f flag or, by default, the standard system ac-
  tivity daily data file, the /var/adm/sa/sadd file, where the dd
  parameter indicates the current day.
  
  You can select information about specific system activities using
  flags.  Not specifying any flags selects only system unit activi-
  ty.  Specifying the -A flag selects all activities.
  
  The default version of the sar command (CPU utilization report)
  might be one  of the first facilities the user runs to begin sys-
  tem  activity  investigation,  because  it  monitors major system
  resources.  If CPU utilization  is  near 100 percent (user + sys-
  tem), the workload sampled is CPU-bound.  If  a considerable per-
  centage of time is spent in I/O wait, it impliesthat CPU execu-
  tion is  blocked  waiting  for disk I/O.  The I/O may be required
  file accesses or it  may  be  I/O associated with paging due to a
  lack of sufficient memory.
  
  Note:	The time the system spends waiting for remote file access
  is not accumulated in the I/O wait time.  If CPU utilization and
  I/O wait time for a task are relatively  low,  and  the  response
  time is not satisfactory, consider investigating how much time is
  being spent waiting for remote I/O.  Since  no high-level command
  provides statistics on remote I/O wait, trace data may  be useful
  in observing this.
  
  If multiple samples and multiple reports are desired, it is con-
  venient to specify an output file for the sar command.  Direct
  the standard output data from the sar command to /dev/null and
  run the sar command as a background process.  The syntax for this
  is:
  
  sar -A -o data.file interval count > /dev/null &
  
  All data is captured in binary form and saved to a file
  (data.file).  The data can then be selectively displayed with the
  sar command using the -f option.
  
  The sar command calls a process named sadc to access system data.
  Two shell scripts (/usr/lib/sa/sa1 and /usr/lib/sa/sa2) are
  structured to be run by the  cron command and provide daily
  statistics and reports.  Sample stanzas  are  included  (but com-
  mented out) in the /var/spool/cron/crontab/adm crontab file to
  specify when the cron daemon should run the shell scripts.  Col-
  lection of  data  in this manner is useful to characterize system
  usage over a period of time and determine peak usage hours.
  
  Note:	The sar command only reports on local activities.
  
  You can use the System Management Interface Tool (SMIT) to run
  the sar command.  To use SMIT, enter:
  
  smit sar
  
  Flags
  
  -A	Reports all data.
  
  -a	Reports use of file access system routines specifying how many
  times per second several of the system file access routines  have
  been called.  The following values are accepted:
  
  dirblk/s	Number of 512-byte blocks read by the directory search
  routine to locate a directory entry for a specific file.
  
  iget/s	Calls to any of several i-node lookup routines that sup-
  port multiple file system types.  The iget routines return a
  pointer to the i-node structure of a file or device.
  
  lookuppn/s	Calls to the directory search routine that finds the
  address of a v-node given a path name.  
  
  -b	Reports buffer activity for transfers, accesses, and cache
  (kernel block buffer cache) hit ratios  per  second.    Access to
  most files in AIX bypasses  kernel block buffering, and therefore
  does not generate these statistics.  However,  if a program opens
  a block device or a raw character device for I/O, traditional ac-
  cess mechanisms are used making the generated statistics meaning-
  ful.  The following values are accepted:
  
  bread/s, bwrit/s	Reports the number of block I/O operations.
  These I/Os are generally performed by the kernel to manage the
  block buffer cache area, as discussed in the description  of  the
  lread/s value.
  
  lread/s, lwrit/s	Reports the number of logical I/O requests.
  When a logical read or write to a block device is performed, a
  logical transfer size of less than  a  full block size may be re-
  quested.  The system accesses the physical device  units  of com-
  plete blocks and buffers these blocks  in the kernel buffers that
  have been set aside for this purpose (the block I/O  cache area).
  This  cache area is managed by the kernel, so that multiple logi-
  cal  reads  and  writes to the block device can access previously
  buffered data from  the cache and require no real I/O to the dev-
  ice.  Application read and write requests to the block device are
  reported statistically as logical reads and  writes.    The block
  I/O performed by the kernel to the block device in management  of
  the cache area is reported as block reads and block writes.
  
  pread/s, pwrit/s	Reports the number of I/O operations on raw dev-
  ices.  Requested I/O to raw character devices is not buffered as
  it  is  for block devices.  The I/O is performed  to  the  device
  directly.
  
  %rcache, %wcache	Reports caching effectiveness (cache hit percen-
  tage).    This  percentage  is  calculated  as  [(100)x(lreads  -
  breads)/(lreads)].
  
  -c	Reports system calls.  The following values are accepted:
  
  exec/s, fork/s	Reports the total number of fork and exec system
  calls.
  
  sread/s, swrit/s	Reports the total number of read/write system
  calls.
  
  rchar/s, wchar/s	Reports the total number of characters
  transferred by read/write system calls.
  
  scall/s	Reports the total number of system calls.
  
  Note:	The sar command itself can generate a considerable number
  of reads and writes depending on the interval at which it is run.
  Run the sar statistics without the workload to understand the sar
  command's contribution to your total statistics.
  
  -e hh[:mm[:ss]]	Sets the ending time of the report.  The default
  ending time is 18:00.
  
  -f File	Extracts records from File (created by -o File flag).
  The default value of the File parameter is the current daily data
  file, the /var/adm/sa/sadd file.
  
  -i Seconds	Selects data records at seconds as close as possible
  to the number specified by the Seconds parameter.  Otherwise, the
  sar command reports all seconds found in the data file.
  
  -k	Reports kernel process activity.  The following values are ac-
  cepted:
  
  kexit/s	Reports the number of kernel processes terminating per
  second.
  
  kproc-ov/s	Reports the number of times kernel processes could not
  be created because of enforcement of process threshold limit.
  
  ksched/s	Reports the number of kernel processes assigned to tasks
  per second.
  
  -m	Reports message and semaphore activities per second.  The fol-
  lowing values are accepted:
  
  msg/s	Reports the number of IPC message primitives.
  
  sema/s	Reports the number of IPC semaphore primitives.
  
  -o File	Saves the readings in the file in binary form.  Each
  reading is in a separate  record  and  each record contains a tag
  identifying the time of the reading.
  
  -q	Reports queue statistics.  The following values are accepted:
  
  runq-sz 	Reports the average number of processes in the run
  queue.
  
  %runocc	Reports the percentage of the time the run queue is occu-
  pied.
  
  swpq-sz	Reports the average number of processes waiting to be
  paged in.
  
  %swpocc	Reports the percentage of the time the swap queue is oc-
  cupied.
  
  Note:	A blank value in any column indicates that the associated
  queue is empty.
  
  -r	Reports paging statistics.  The following values are accepted:
  
  cycle/s	Reports the number of page replacement cycles per second.
  
  fault/s	Reports the number of page faults per second.  This is
  not a count of  page  faults that generate I/O, because some page
  faults can be resolved without I/O.
  
  slots	Reports the number of free pages on the paging spaces.
  
  odio/s	Reports the number of nonpaging disk I/Os per second.
  
  -s hh[:mm[:ss]]	Sets the starting time of the data, causing the
  sar command to extract records time-tagged at, or following, the
  time specified.  The default starting time is 08:00.
  
  -u	Reports system unit activity.  The following values are ac-
  cepted:
  
  %idle	Reports the percentage of time the system unit was idle
  with no outstanding disk I/O requests.
  
  %sys	Reports the percentage of time the system unit spent in exe-
  cution at the system (or kernel) level.
  
  %usr	Reports the percentage of time the system unit spent in exe-
  cution at the user (or application) level.
  
  %wio	Reports the percentage of time the system unit was idle
  waiting for disk I/O to complete.
  
  Note:	The sar command reports system unit activity if no other
  specific content options are requested.  
  
  -v	Reports status of the process, i-node, and file tables.  The
  following values are accepted:
  
  file-ov, proc-ov 	Reports the number of times per second the file
  or process table overflowed.
  
  file-sz, inod-sz, proc-sz 	Reports the number of entries in use
  for each table.
  
  Note:	The I-node System Tables are dynamically allocated when
  inod-sz is reaching maximum, so there is never a possibility of
  an overflow.
  
  -w	Reports system switching activity.  The following value is ac-
  cepted:
  
  pswch/s	Process switches per second. The following values are ac-
  cepted:
  
  -y	Reports tty device activity per second.
  
  canch/s	Reports tty canonical input queue characters.
  
  mdmin/s	Reports tty modem interrupts.
  
  outch/s	Reports tty output queue characters.
  
  rawch/s	Reports tty raw input queue characters.
  
  revin/s	Reports tty receive interrupts.
  
  xmtin/s	Reports tty transmit interrupts.
  
  Security
  
  Access Control: These commands should grant execute (x) access
  only to members of the adm group.
  
  Examples
  
  1.	To report system unit activity, enter:
  
  sar
  
  2.	To report current tty activity for each 2 seconds for the next
  20 seconds, enter:
  
  sar -y -r 2 20
  
  3.	To watch system unit for 10 minutes and sort data, enter:
  
  sar -o temp 60 10
  
  Implementation Specifics
  
  This command is part of Base Operating System (BOS) Runtime.
  
  Files
  
  /usr/sbin/sar	Specifies the path to the sar command.
  
  /bin/sar	Indicates the symbolic link to the sar command.
  
  /var/adm/sa/sadd	Indicates the daily data file, where the dd
  parameter is a number representing the day of the month.
  
  Related Information
  
  The  sag command,  sadc command,  sa1 command,  sa2 command.
  
   Accounting Overview in the AIX Version 3.2 System Management
  Guide: Operating System and Devices.
  
   How to Set Up an Accounting System in the AIX Version 3.2 System
  Management Guide: Operating System and Devices.
  
   Accounting Commands in the AIX Version 3.2 System Management
  Guide: Operating System and Devices lists accounting commands
  that can be run  automatically or entered from the  keyboard.
  
   AIX Performance Monitoring and Tuning Commands in AIX Version
  3.2 Performance Monitoring and Tuning Guide.