Seth Woolley's Man Viewer

sar(1) - sar - Collect, report, or save system activity information - man 1 sar

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

SAR(1)                        Linux User's Manual                       SAR(1)



NAME
       sar - Collect, report, or save system activity information.

SYNOPSIS
       sar  [ -A ] [ -b ] [ -B ] [ -c ] [ -d ] [ -i interval ] [ -p ] [ -q ] [
       -r ] [ -R ] [ -t ] [ -u ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ] [ -n { DEV
       |  EDEV | NFS | NFSD | SOCK | FULL } ] [ -x { pid | SELF | ALL } ] [ -X
       { pid | SELF | ALL } ] [ -I { irq | SUM | ALL | XALL } ] [ -P {  cpu(5,8,8 cpu-ldap)  |
       ALL  } ] [ -o [ filename ] | -f [ filename ] ] [ -s [ hh:mm:ss ] ] [ -e
       [ hh:mm:ss ] ] [ interval [ count ] ]

DESCRIPTION
       The sar command writes to standard  output  the  contents  of  selected
       cumulative  activity  counters  in(1,8) the operating system. The accounting
       system, based on the values  in(1,8)  the  count  and  interval  parameters,
       writes  information  the specified number of times spaced at the speci-
       fied intervals in(1,8) seconds.  If the interval parameter is set(7,n,1 builtins)  to  zero,
       the  sar command displays the average statistics for the time(1,2,n) since the
       system was started. The default value for the count parameter is 1.  If
       its value is set(7,n,1 builtins) to zero, then reports are generated continuously.  The
       collected data can also be saved in(1,8) the file(1,n) specified by the -o  file-
       name  flag, in(1,8) addition to being displayed onto the screen. If filename
       is omitted, sar uses the standard system activity daily data file(1,n),  the
       /var/log/sa/sadd  file(1,n),  where  the  dd parameter indicates the current
       day.

       The sar command extracts and writes to standard output  records  previ-
       ously saved in(1,8) a file. This file(1,n) can be either the one specified by the
       -f flag or, by default, the standard system activity daily data file.

       Without the -P flag, the sar command reports system-wide (global  among
       all processors) statistics, which are calculated as averages for values
       expressed as percentages, and as sums otherwise.  If  the  -P  flag  is
       given,  the sar command reports activity which relates to the specified
       processor or processors. If -P ALL is given, the  sar  command  reports
       statistics  for  each  individual processor and global statistics among
       all processors.

       You can select(2,7,2 select_tut)  information  about  specific  system  activities  using
       flags.  Not specifying any flags selects only CPU activity.  Specifying
       the -A flag is equivalent to specifying -bBcdqrRuvwWy -I SUM -I XALL -n
       FULL -P ALL.

       The  default  version(1,3,5) of the sar command (CPU utilization report) might
       be one of the first facilities the user runs to begin  system  activity
       investigation,  because it monitors major system resources. If CPU uti-
       lization is near 100 percent (user + nice(1,2) + system), the workload  sam-
       pled is CPU-bound.

       If  multiple samples and multiple reports are desired, it is convenient
       to specify an output file(1,n) for the sar command.  Run the sar command  as
       a background process. The syntax for this is:

       sar -o data.file interval count >/dev/null 2>&1 &

       All  data  is  captured in(1,8) binary form and saved to a file(1,n) (data.file).
       The data can then be selectively displayed with the sar  command  using
       the  -f  option.  Set the interval and count parameters to select(2,7,2 select_tut) count
       records at interval second intervals. If the  count  parameter  is  not
       set(7,n,1 builtins), all the records saved in(1,8) the file(1,n) will be selected.  Collection of
       data in(1,8) this manner is useful  to  characterize  system  usage  over  a
       period of time(1,2,n) and determine peak usage hours.

       Note:     The sar command only reports on local activities.


OPTIONS
       -A     This is equivalent to specifying -bBcdqrRuvwWy -I SUM -I XALL -n
              FULL -P ALL.

       -b     Report I/O and transfer rate statistics.  The  following  values
              are displayed:

              tps
                     Total  number of transfers per second that were issued to
                     physical devices.  A transfer is  an  I/O  request  to  a
                     physical  device.  Multiple  logical requests can be com-
                     bined into a single I/O request to the device.  A  trans-
                     fer is of indeterminate size.

              rtps
                     Total number of read(2,n,1 builtins) requests per second issued to physi-
                     cal devices.

              wtps
                     Total number of write(1,2) requests per second issued to phys-
                     ical devices.

              bread/s
                     Total  amount of data read(2,n,1 builtins) from the devices in(1,8) blocks per
                     second.  Blocks are equivalent to sectors with  2.4  ker-
                     nels  and  newer  and therefore have a size of 512 bytes.
                     With older kernels, a block is of indeterminate size.

              bwrtn/s
                     Total amount of data written to  devices  in(1,8)  blocks  per
                     second.

       -B     Report paging statistics. The following values are displayed:

              pgpgin/s
                     Total  number  of kilobytes the system paged in(1,8) from disk
                     per second.

              pgpgout/s
                     Total number of kilobytes the system paged  out  to  disk
                     per second.

              fault/s
                     Number  of page faults (major + minor) made by the system
                     per second (post 2.5 kernels only).  This is not a  count
                     of  page  faults  that  generate  I/O,  because some page
                     faults can be resolved without I/O.

              majflt/s
                     Number of major faults the system has  made  per  second,
                     those which have required loading a memory page from disk
                     (post 2.5 kernels only).

       -c     Report process creation activity.

              proc(5,n)/s
                     Total number of processes created per second.

       -d     Report activity for each block device  (kernels  2.4  and  newer
              only).  When data is displayed, the device specification dev m-n
              is generally used ( DEV column).  m is the major number  of  the
              device.   With  recent kernels (post 2.5), n is the minor number
              of the device, but is only a sequence number with pre  2.5  ker-
              nels.  Device  names  may also be pretty-printed if(3,n) option -p is
              used (see below). Values for fields avgqu-sz, await,  svctm  and
              %util  may  be  unavailable  and displayed as 0.00 with some 2.4
              kernels.

              tps
                     Indicate the number of transfers  per  second  that  were
                     issued  to  the device.  Multiple logical requests can be
                     combined into a single  I/O  request  to  the  device.  A
                     transfer is of indeterminate size.

              rd_sec/s
                     Number  of  sectors  read(2,n,1 builtins)  from the device. The size of a
                     sector is 512 bytes.

              wr_sec/s
                     Number of sectors written to the device. The  size  of  a
                     sector is 512 bytes.

              avgrq-sz
                     The  average  size (in(1,8) sectors) of the requests that were
                     issued to the device.

              avgqu-sz
                     The average queue(1,3) length of the requests that were issued
                     to the device.

              await
                     The  average  time(1,2,n)  (in(1,8)  milliseconds)  for  I/O requests
                     issued to the device to be served. This includes the time(1,2,n)
                     spent by the requests in(1,8) queue(1,3) and the time(1,2,n) spent servic-
                     ing them.

              svctm
                     The  average  service  time(1,2,n)  (in(1,8)  milliseconds)  for  I/O
                     requests that were issued to the device.

              %util
                     Percentage  of  CPU  time(1,2,n)  during which I/O requests were
                     issued to  the  device  (bandwidth  utilization  for  the
                     device).  Device  saturation  occurs  when  this value is
                     close(2,7,n) to 100%.

       -e hh:mm:ss
              Set the ending time(1,2,n) of the report. The default  ending  time(1,2,n)  is
              18:00:00.  Hours  must  be given in(1,8) 24-hour format.  This option
              can be used only when data are read(2,n,1 builtins) from or written  to  a  file(1,n)
              (options -f or -o ).

       -f filename
              Extract records from filename (created by the -o filename flag).
              The default value of the filename parameter is the current daily
              data file(1,n), the /var/log/sa/sadd file. The -f option is exclusive
              of the -o option.

       -i interval
              Select data records at seconds as close(2,7,n) as possible to the  num-
              ber specified by the interval parameter.

       -I irq | SUM | ALL | XALL
              Report  statistics  for a given interrupt.  irq is the interrupt
              number. Specifying multiple -I irq  parameters  on  the  command
              line will look(1,8,3 Search::Dict) at multiple independent interrupts.  The SUM key-
              word indicates that the total number of interrupts received  per
              second  is  to be displayed. The ALL keyword indicates that sta-
              tistics from the first 16 interrupts are to be reported, whereas
              the  XALL keyword indicates that statistics from all interrupts,
              including potential APIC interrupt sources, are to be  reported.

       -n DEV | EDEV | NFS | NFSD | SOCK | FULL
              Report network statistics.

              With  the  DEV  keyword, statistics from the network devices are
              reported.  The following values are displayed:

              IFACE
                     Name of the network interface for  which  statistics  are
                     reported.

              rxpck/s
                     Total number of packets received per second.

              txpck/s
                     Total number of packets transmitted per second.

              rxbyt/s
                     Total number of bytes received per second.

              txbyt/s
                     Total number of bytes transmitted per second.

              rxcmp/s
                     Number  of  compressed  packets  received per second (for
                     cslip etc.).

              txcmp/s
                     Number of compressed packets transmitted per second.

              rxmcst/s
                     Number of multicast packets received per second.

              With the EDEV keyword, statistics on failures (errors) from  the
              network  devices  are  reported.   The following values are dis-
              played:

              IFACE
                     Name of the network interface for  which  statistics  are
                     reported.

              rxerr/s
                     Total number of bad packets received per second.

              txerr/s
                     Total  number  of  errors  that happened per second while
                     transmitting packets.

              coll/s
                     Number of  collisions  that  happened  per  second  while
                     transmitting packets.

              rxdrop/s
                     Number  of received packets dropped per second because of
                     a lack of space in(1,8) linux buffers.

              txdrop/s
                     Number of transmitted packets dropped per second  because
                     of a lack of space in(1,8) linux buffers.

              txcarr/s
                     Number  of  carrier-errors that happened per second while
                     transmitting packets.

              rxfram/s
                     Number of frame alignment errors that happened per second
                     on received packets.

              rxfifo/s
                     Number of FIFO overrun errors that happened per second on
                     received packets.

              txfifo/s
                     Number of FIFO overrun errors that happened per second on
                     transmitted packets.

              With  the  NFS keyword, statistics about NFS client activity are
              reported.  The following values are displayed:

              call/s
                     Number of RPC requests made per second.

              retrans/s
                     Number of RPC requests per second, those which needed  to
                     be  retransmitted  (for example because of a server time-
                     out(1,3x,3x cbreak)).

              read(2,n,1 builtins)/s
                     Number of 'read(2,n,1 builtins)' RPC calls made per second.

              write(1,2)/s
                     Number of 'write(1,2)' RPC calls made per second.

              access(2,5)/s
                     Number of 'access(2,5)' RPC calls made per second.

              getatt/s
                     Number of 'getattr' RPC calls made per second.

              With the NFSD keyword, statistics about NFS server activity  are
              reported.  The following values are displayed:

              scall/s
                     Number of RPC requests received per second.

              badcall/s
                     Number  of  bad  RPC  requests received per second, those
                     whose processing generated an error.

              packet/s
                     Number of network packets received per second.

              udp/s
                     Number of UDP packets received per second.

              tcp/s
                     Number of TCP packets received per second.

              hit/s
                     Number of reply cache hits per second.

              miss/s
                     Number of reply cache misses per second.

              sread/s
                     Number of 'read(2,n,1 builtins)' RPC calls received per second.

              swrite/s
                     Number of 'write(1,2)' RPC calls received per second.

              saccess/s
                     Number of 'access(2,5)' RPC calls received per second.

              sgetatt/s
                     Number of 'getattr' RPC calls received per second.

              With  the  SOCK  keyword,  statistics  on  sockets  in(1,8)  use  are
              reported.  The following values are displayed:

              totsck
                     Total number of used sockets.

              tcpsck
                     Number of TCP sockets currently in(1,8) use.

              udpsck
                     Number of UDP sockets currently in(1,8) use.

              rawsck
                     Number of RAW sockets currently in(1,8) use.

              ip-frag
                     Number of IP fragments currently in(1,8) use.

              The  FULL  keyword  is equivalent to specifying all the keywords
              above and therefore all the network activities are reported.

       -o filename
              Save the readings in(1,8) the file(1,n) in(1,8) binary form. Each reading is in(1,8)
              a  separate  record. The default value of the filename parameter
              is the current daily data file(1,n), the /var/log/sa/sadd  file.  The
              -o option is exclusive of the -f option.

       -P cpu(5,8,8 cpu-ldap) | ALL
              Report  per-processor  statistics for the specified processor or
              processors.  Specifying the ALL keyword reports  statistics  for
              each  individual processor, and globally for all processors.  Of
              the flags which specify the statistics to be reported, only  the
              -u  and  -I SUM flags are meaningful with the -P flag. Note that
              processor 0 is the first processor.

       -p     Pretty-print device names. Use this option in(1,8)  conjunction  with
              option  -d.  By default names are printed as dev m-n where m and
              n are the major and minor numbers for the device.  Use  of  this
              option displays the names of the devices as they (should) appear
              in(1,8) /dev. Name mappings  are  controlled  by  /etc/sysconfig/sys-
              stat.ioconf.

       -q     Report  queue(1,3) length and load(7,n) averages. The following values are
              displayed:

              runq-sz
                     Run queue(1,3) length (number of  processes  waiting  for  run
                     time(1,2,n)).

              plist-sz
                     Number of processes in(1,8) the process list.

              ldavg-1
                     System load(7,n) average for the last minute.

              ldavg-5
                     System load(7,n) average for the past 5 minutes.

              ldavg-15
                     System load(7,n) average for the past 15 minutes.

       -r     Report  memory  and swap space utilization statistics.  The fol-
              lowing values are displayed:

              kbmemfree
                     Amount of free memory available in(1,8) kilobytes.

              kbmemused
                     Amount of used memory in(1,8) kilobytes. This  does  not  take
                     into account memory used by the kernel itself.

              %memused
                     Percentage of used memory.

              kbbuffers
                     Amount  of  memory used as buffers by the kernel in(1,8) kilo-
                     bytes.

              kbcached
                     Amount of memory used to cache  data  by  the  kernel  in(1,8)
                     kilobytes.

              kbswpfree
                     Amount of free swap space in(1,8) kilobytes.

              kbswpused
                     Amount of used swap space in(1,8) kilobytes.

              %swpused
                     Percentage of used swap space.

              kbswpcad
                     Amount  of cached swap memory in(1,8) kilobytes.  This is mem-
                     ory that once was swapped out, is  swapped  back  in(1,8)  but
                     still  also  is  in(1,8) the swap area (if(3,n) memory is needed it
                     doesn't need to  be  swapped  out  again  because  it  is
                     already in(1,8) the swap area. This saves I/O).

       -R     Report memory statistics. The following values are displayed:

              frmpg/s
                     Number of memory pages freed by the system per second.  A
                     negative value represents a number of pages allocated  by
                     the  system.  Note that a page has a size of 4 kB or 8 kB
                     according to the machine architecture.

              bufpg/s
                     Number of additional memory pages used as buffers by  the
                     system  per  second.   A negative value means fewer pages
                     used as buffers by the system.

              campg/s
                     Number of additional memory pages cached  by  the  system
                     per  second.   A  negative value means fewer pages in(1,8) the
                     cache.

       -s hh:mm:ss
              Set the starting time(1,2,n) of the data, causing the  sar  command  to
              extract  records  time-tagged  at, or following, the time(1,2,n) speci-
              fied. The default starting time(1,2,n) is 08:00.  Hours must  be  given
              in(1,8)  24-hour  format.  This option can be used only when data are
              read(2,n,1 builtins) from a file(1,n) (option -f ).

       -t     When reading data from a daily  data  file(1,n),  indicate  that  sar
              should display the timestamps in(1,8) the original locale(3,5,7) time(1,2,n) of the
              data file(1,n) creator. Without this option, the sar command displays
              the timestamps in(1,8) the user locale(3,5,7) time.

       -u     Report CPU utilization. The following values are displayed:

              %user
                     Percentage of CPU utilization that occurred while execut-
                     ing at the user level (application).

              %nice(1,2)
                     Percentage of CPU utilization that occurred while execut-
                     ing at the user level with nice(1,2) priority.

              %system
                     Percentage of CPU utilization that occurred while execut-
                     ing at the system level (kernel).

              %iowait
                     Percentage of time(1,2,n) that the CPU or CPUs were idle  during
                     which the system had an outstanding disk I/O request.

              %idle
                     Percentage of time(1,2,n) that the CPU or CPUs were idle and the
                     system did not have an outstanding disk I/O request.

       -v     Report status of inode, file(1,n) and other kernel tables.  The  fol-
              lowing values are displayed:

              dentunusd
                     Number of unused cache entries in(1,8) the directory cache.

              file-sz
                     Number of used file(1,n) handles.

              inode-sz
                     Number of used inode handlers.

              super-sz
                     Number of super block handlers allocated by the kernel.

              %super-sz
                     Percentage  of allocated super block handlers with regard
                     to the maximum number of super block handlers that  Linux
                     can allocate.

              dquot-sz
                     Number of allocated disk quota(1,8) entries.

              %dquot-sz
                     Percentage of allocated disk quota(1,8) entries with regard to
                     the maximum number of cached disk quota(1,8) entries that  can
                     be allocated.

              rtsig-sz
                     Number of queued RT signals.

              %rtsig-sz
                     Percentage  of queued RT signals with regard to the maxi-
                     mum number of RT signals that can be queued.

       -V     Print version(1,3,5) number and usage then exit.

       -w     Report system switching activity.

              cswch/s
                     Total number of context switches per second.

       -W     Report swapping statistics. The following values are displayed:

              pswpin/s
                     Total number of swap pages the system brought in(1,8) per sec-
                     ond.

              pswpout/s
                     Total  number  of  swap  pages the system brought out per
                     second.

       -x pid | SELF | ALL
              Report statistics for a given process.  pid is the process iden-
              tification  number.  The  SELF keyword indicates that statistics
              are to be reported for the sar process itself, whereas  the  ALL
              keyword indicates that statistics are to be reported for all the
              system processes.  All these statistics cannot  be  saved  to  a
              file.   So  this  option  will  be ignored whenever -o option is
              used.  Specifying multiple -x pid parameters on the command line
              will  look(1,8,3 Search::Dict)  at  multiple  independent processes.  At the present
              time(1,2,n), no more than 256 processes  can  be  monitored  simultane-
              ously.

              The following values are displayed:

              minflt/s
                     Total  number  of  minor  faults the process has made per
                     second, those which have not required  loading  a  memory
                     page from disk.

              majflt/s
                     Total  number  of  major  faults the process has made per
                     second, those which have required loading a  memory  page
                     from disk.

              %user
                     Percentage  of CPU used by the process while executing at
                     the user level (application).

              %system
                     Percentage of CPU used by the process while executing  at
                     the system level (kernel).

              nswap/s
                     Number of pages from the process address space the system
                     has swapped out per second.

              CPU
                     Processor number to which the process is attached.

       -X pid | SELF | ALL
              Report statistics for the child processes of the  process  whose
              PID  is pid .  The SELF keyword indicates that statistics are to
              be reported for the child processes of the sar  process  itself,
              whereas  the  ALL  keyword  indicates  that statistics are to be
              reported for all the child processes  of  all  the  system  pro-
              cesses.   All  these  statistics  cannot be saved to a file.  So
              this option will be ignored whenever -o option is used.   Speci-
              fying  multiple  -X pid parameters on the command line will look(1,8,3 Search::Dict)
              at multiple independent processes.  At the present time(1,2,n), no more
              than 256 processes can be monitored simultaneously.  The follow-
              ing values are displayed:

              cminflt/s
                     Total number of minor faults  the  child  processes  have
                     made  per second, those which have not required loading a
                     memory page from disk.

              cmajflt/s
                     Total number of major faults  the  child  processes  have
                     made per second, those which have required loading a mem-
                     ory page from disk.

              %cuser
                     Percentage of CPU used by the child processes while  exe-
                     cuting at the user level (application).

              %csystem
                     Percentage  of CPU used by the child processes while exe-
                     cuting at the system level (kernel).

              cnswap/s
                     Number of pages from the child process address spaces the
                     system has swapped out per second.

       -y     Report TTY device activity. The following values are displayed:

              rcvin/s
                     Number  of  receive  interrupts  per  second  for current
                     serial line. Serial line number is given in(1,8) the TTY  col-
                     umn.

              xmtin/s
                     Number  of  transmit  interrupts  per  second for current
                     serial line.

              Note that with recent  2.6  kernels,  these  statistics  can  be
              retrieved only by root.


ENVIRONMENT
       The sar command takes into account the following environment variable:


       S_TIME_FORMAT
              If  this  variable  exists and its value is ISO then the current
              locale(3,5,7) will be ignored when printing  the  date  in(1,8)  the  report
              header.   The sar command will use the ISO 8601 format (YYYY-MM-
              DD) instead.


EXAMPLES
       sar -u 2 5
              Report CPU utilization for each 2  seconds.  5  lines  are  dis-
              played.

       sar -I 14 -o int14.file 2 10
              Report  statistics  on  IRQ  14 for each 2 seconds. 10 lines are
              displayed.  Data are stored in(1,8) a file(1,n) called int14.file.

       sar -r -n DEV -f /var/log/sa/sa16
              Display memory, swap space and network statistics saved in(1,8) daily
              data file(1,n) 'sa16'.

       sar -A
              Display all the statistics saved in(1,8) current daily data file.

BUGS
       /proc(5,n) filesystem must be mounted for the sar command to work.

       All the statistics are not necessarily available, depending on the ker-
       nel version(1,3,5) used.

FILES
       /var/log/sa/sadd
              Indicate the daily data file(1,n), where the dd parameter is a number
              representing the day of the month.

       /proc(5,n) contains various files with system statistics.

AUTHOR
       Sebastien Godard (sysstat <at> wanadoo.fr)

SEE ALSO
       sadc(8),   sa1(8),  sa2(8),  sadf(1),  isag(1),  mpstat(1),  iostat(1),
       vmstat(8)

       http://perso.wanadoo.fr/sebastien.godard/



Linux                            DECEMBER 2004                          SAR(1)

References for this manual (incoming links)