<chapter id="spmonitor-24844"><title>Monitoring System
Performance (Tasks)</title><highlights><para>This chapter describes procedures for monitoring system performance
by using the <command>vmstat</command>, <command>iostat</command>, <command>df</command>,
and <command>sar</command> commands.</para><itemizedlist><para>For information on the procedures that are associated with monitoring
system performance, see the following:</para><listitem><para><olink targetptr="enudl" remap="internal">Displaying System Performance Information
(Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="enudq" remap="internal">Monitoring System Activities (Task
Map)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="enudl"><title>Displaying System Performance Information (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display virtual memory Statistics.</para>
</entry><entry><para>Collect virtual memory statistics by using the <command>vmstat</command> command.</para>
</entry><entry><para><olink targetptr="enudr" remap="internal">How to Display Virtual Memory Statistics (vmstat)</olink></para>
</entry>
</row><row><entry><para>Display system event information.</para>
</entry><entry><para>Display system event information by using the <command>vmstat</command> command
with the <option>s</option> option</para>
</entry><entry><para><olink targetptr="enudw" remap="internal">How to Display System Event Information (vmstat
-s)</olink></para>
</entry>
</row><row><entry><para>Display swapping statistics.</para>
</entry><entry><para>Use the <command>vmstat</command> command with the <option>S</option> option
to display swapping statistics.</para>
</entry><entry><para><olink targetptr="enudm" remap="internal">How to Display Swapping Statistics (vmstat
-S)</olink></para>
</entry>
</row><row><entry><para>Display interrupts per device.</para>
</entry><entry><para>Use the <command>vmstat</command> command with the <option>i</option> option
to show the number of interrupts per device.</para>
</entry><entry><para><olink targetptr="enudt" remap="internal">How to Display Interrupts Per Device (vmstat
-i)</olink></para>
</entry>
</row><row><entry><para>Display disk utilization.</para>
</entry><entry><para>Use the <command>iostat</command> command to report disk input and output
statistics.</para>
</entry><entry><para><olink targetptr="enudv" remap="internal">How to Display Disk Utilization Information
(iostat)</olink></para>
</entry>
</row><row><entry><para>Display extended disk statistics.</para>
</entry><entry><para>Use the <command>iostat</command> command with the <option>xtc</option>option
to display extended disk statistics.</para>
</entry><entry><para><olink targetptr="enueb" remap="internal">How to Display Extended Disk Statistics (iostat
-xtc)</olink></para>
</entry>
</row><row><entry><para>Display disk space information.</para>
</entry><entry><para>The <command>df</command> <option>k</option> command displays disk space
information in Kbytes.</para>
</entry><entry><para><olink targetptr="enudy" remap="internal">How to Display Disk Space Information (df -k)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="spmonitor-22"><title>Displaying Virtual Memory Statistics (<command>vmstat</command>)</title><para>You can use the <command>vmstat</command> command to report virtual memory statistics and information about
system events such as CPU load, paging, number of context switches, device
interrupts, and system calls. The <command>vmstat</command> command can also
display statistics on swapping, cache flushing, and interrupts.</para><para>The following
table describes the fields in the <command>vmstat</command> command output.
 </para><table frame="topbot" id="spmonitor-57160"><title>Output From the <command>vmstat</command> Command</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="71*"/><colspec colname="column2" colwidth="72*"/><colspec colname="column3" colwidth="216*"/><thead><row rowsep="1"><entry><para>Category</para>
</entry><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>procs</literal></para>
</entry><entry><para></para>
</entry><entry><para>Reports on the following:</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>r</literal> </para>
</entry><entry><para>The number of kernel threads in the dispatch queue</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>b</literal></para>
</entry><entry><para>The number of blocked kernel threads that are waiting for resources</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>w</literal></para>
</entry><entry><para>The number of swapped out LWPs that are waiting for processing resources
to finish </para>
</entry>
</row><row><entry><para><literal>memory</literal></para>
</entry><entry><para></para>
</entry><entry><para>Reports on usage of real memory and virtual memory:</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>swap</literal> </para>
</entry><entry><para>Available swap space</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>free</literal>  </para>
</entry><entry><para>Size of the free list</para>
</entry>
</row><row><entry><para><literal>page</literal></para>
</entry><entry><para></para>
</entry><entry><para>Reports on page faults and paging activity, in units per second:</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>re</literal></para>
</entry><entry><para>Pages reclaimed</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>mf</literal></para>
</entry><entry><para>Minor faults and major faults</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>pi</literal> </para>
</entry><entry><para>Kbytes paged in</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>po</literal> </para>
</entry><entry><para>Kbytes paged out</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>fr</literal> </para>
</entry><entry><para>Kbytes freed</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>de</literal></para>
</entry><entry><para>Anticipated memory that is needed by recently swapped-in processes</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>sr</literal></para>
</entry><entry><para>Pages scanned by the <command>page</command> daemon not currently in
use. If <literal>sr</literal> does not equal zero, the <command>page</command> daemon
has been running.</para>
</entry>
</row><row><entry><para><literal>disk</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Reports the number of disk operations per second, showing data on up
to four disks</para>
</entry>
</row><row><entry><para><literal>faults</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Reports the trap/interrupt rates per second:</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>in</literal> </para>
</entry><entry><para>Interrupts per second</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>sy</literal></para>
</entry><entry><para>System calls per second</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>cs</literal> </para>
</entry><entry><para>CPU context switch rate</para>
</entry>
</row><row><entry><para><literal>cpu</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Reports on the use of CPU time:</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>us</literal>  </para>
</entry><entry><para>User time</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>sy</literal>  </para>
</entry><entry><para>System time</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><literal>id</literal>  </para>
</entry><entry><para>Idle time </para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>For a more detailed description of this command, see the <olink targetdoc="refman" targetptr="vmstat-1m" remap="external"><citerefentry><refentrytitle>vmstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><task id="enudr"><title>How to Display Virtual Memory Statistics (<command>vmstat</command>)</title><procedure remap="single-step"><step><para>Collect virtual memory statistics by using the <command>vmstat</command> command
with a time interval in seconds.</para><screen>$ <userinput>vmstat</userinput> <replaceable>n</replaceable></screen><para>where <replaceable>n</replaceable> is the interval in seconds between
reports.</para>
</step>
</procedure><example id="spmonitor-2"><title>Displaying Virtual Memory Statistics</title><para>The following example shows the <command>vmstat</command> display of
statistics that were gathered at five-second intervals.</para><screen width="100">$ <userinput>vmstat 5</userinput>
kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr dd f0 s1 --   in   sy   cs us sy id
 0 0 0 863160 365680  0   3  1  0  0  0  0  0  0  0  0  406  378  209  1  0 99
 0 0 0 765640 208568  0  36  0  0  0  0  0  0  0  0  0  479 4445 1378  3  3 94
 0 0 0 765640 208568  0   0  0  0  0  0  0  0  0  0  0  423  214  235  0  0 100
 0 0 0 765712 208640  0   0  0  0  0  0  0  3  0  0  0  412  158  181  0  0 100
 0 0 0 765832 208760  0   0  0  0  0  0  0  0  0  0  0  402  157  179  0  0 100
 0 0 0 765832 208760  0   0  0  0  0  0  0  0  0  0  0  403  153  182  0  0 100
 0 0 0 765832 208760  0   0  0  0  0  0  0  0  0  0  0  402  168  177  0  0 100
 0 0 0 765832 208760  0   0  0  0  0  0  0  0  0  0  0  402  153  178  0  0 100
 0 0 0 765832 208760  0  18  0  0  0  0  0  0  0  0  0  407  165  186  0  0 100</screen>
</example>
</task><task id="enudw"><title>How to Display System Event Information (<command>vmstat
-s</command>)</title><procedure remap="single-step"><step><para>Run the <command>vmstat -s</command> command to show how many
system events have taken place since the last time the system was booted. </para><screen>$ <userinput>vmstat -s</userinput>
        0 swap ins
        0 swap outs
        0 pages swapped in
        0 pages swapped out
   522586 total address trans. faults taken
    17006 page ins
       25 page outs
    23361 pages paged in
       28 pages paged out
    45594 total reclaims
    45592 reclaims from free list
        0 micro (hat) faults
   522586 minor (as) faults
    16189 major faults
    98241 copy-on-write faults
   137280 zero fill page faults
    45052 pages examined by the clock daemon
        0 revolutions of the clock hand
       26 pages freed by the clock daemon
     2857 forks
       78 vforks
     1647 execs
 34673885 cpu context switches
 65943468 device interrupts
   711250 traps
 63957605 system calls
  3523925 total name lookups (cache hits 99%)
    92590 user   cpu
    65952 system cpu
 16085832 idle   cpu
     7450 wait   cpu</screen>
</step>
</procedure>
</task><task id="enudm"><title>How to Display Swapping Statistics (<command>vmstat
-S</command>)</title><procedure remap="single-step"><step><para>Run <command>vmstat -S</command> to show swapping statistics.</para><screen width="100">$ <userinput>vmstat -S</userinput>
kthr      memory            page            disk          faults      cpu
 r b w   swap  free  si  so pi po fr de sr dd f0 s1 --   in   sy   cs us sy id
 0 0 0 862608 364792  0   0  1  0  0  0  0  0  0  0  0  406  394  213  1  0 99</screen><para>The swapping statistics fields are described in the following list.
For a description of the other fields, see <olink targetptr="spmonitor-57160" remap="internal">Table&nbsp;13&ndash;1</olink>.</para><variablelist><varlistentry><term><literal>si</literal></term><listitem><para>Average number of LWPs that are swapped in per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>so</literal></term><listitem><para>Number of whole processes that are swapped out</para>
</listitem>
</varlistentry>
</variablelist><note><para>The <filename>vmstat</filename> command truncates the output of <literal>si</literal> and <literal>so</literal> fields. Use the <filename>sar</filename> command
to display a more accurate accounting of swap statistics.</para>
</note>
</step>
</procedure>
</task><task id="enudt"><title>How to Display Interrupts Per Device (<command>vmstat
-i</command>)</title><procedure remap="single-step"><step><para>Run the <command>vmstat -i</command> command to show the number
of interrupts per device.</para>
</step>
</procedure><example id="spmonitor-3"><title>Displaying Interrupts Per Device</title><para>The following example shows output from the <command>vmstat -i</command> command. </para><screen>$ <userinput>vmstat -i</userinput>
interrupt         total     rate
--------------------------------
clock          52163269      100
esp0            2600077        4
zsc0              25341        0
zsc1              48917        0
cgsixc0             459        0
lec0             400882        0
fdc0                 14        0
bppc0                 0        0
audiocs0              0        0
--------------------------------
Total          55238959      105</screen>
</example>
</task>
</sect1><sect1 id="spmonitor-4"><title>Displaying Disk Utilization Information (<command>iostat</command>)</title><para>Use the <command>iostat</command> command
to report statistics about disk input and output, and to produce measures
of throughput, utilization, queue lengths, transaction rates, and service
time. For a detailed description of this command, refer to the <olink targetdoc="refman" targetptr="iostat-1m" remap="external"><citerefentry><refentrytitle>iostat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><task id="enudv"><title>How to Display Disk Utilization Information (<command>iostat</command>)</title><procedure remap="single-step"><step><para>You can display disk utilization information by using the <command>iostat</command> command with a time interval in seconds.</para><screen width="100">$ <userinput>iostat 5</userinput>
     tty          fd0           sd3          nfs1         nfs31          cpu
tin tout kps tps serv  kps tps serv  kps tps serv  kps tps serv  us sy wt id
  0    1   0   0  410    3   0   29    0   0    9    3   0   47   4  2  0 94</screen><para>The first line of output shows the statistics since the last time the
system was booted. Each subsequent line shows the interval statistics. The
default is to show statistics for the terminal (<literal>tty</literal>), disks
(<literal>fd</literal> and <literal>sd</literal>), and CPU (<literal>cpu</literal>). </para>
</step>
</procedure><example id="spmonitor-5"><title>Displaying Disk Utilization Information</title><para>The
following example shows disk statistics that were gathered every five seconds. </para><screen width="100">$ <userinput>iostat 5</userinput>
tty        sd0           sd6           nfs1         nfs49           cpu
tin tout kps tps serv  kps tps serv  kps tps serv  kps tps serv  us sy wt id
 0    0   1   0   49    0   0    0    0   0    0    0   0   15   0  0  0 100
 0   47   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16  44   6  132    0   0    0    0   0    0    0   0    0   0  0  1 99
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   3   1   23    0   0    0    0   0    0    0   0    0   0  0  1 99
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100
 0   16   0   0    0    0   0    0    0   0    0    0   0    0   0  0  0 100</screen><para>The following table describes the fields in the output of the <command>iostat <replaceable>n</replaceable></command> command.</para><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row rowsep="1"><entry><para>Device Type</para>
</entry><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Terminal</para>
</entry><entry><para>Device Type</para>
</entry><entry>
</entry>
</row><row><entry>
</entry><entry><para><literal>tin</literal></para>
</entry><entry><para>Number of characters in the terminal input queue</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>tout</literal></para>
</entry><entry><para>Number of characters in the terminal output queue</para>
</entry>
</row><row><entry><para>Disk</para>
</entry><entry><para>Device Type</para>
</entry><entry>
</entry>
</row><row><entry>
</entry><entry><para><literal>bps</literal></para>
</entry><entry><para>Blocks per second</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>tps</literal></para>
</entry><entry><para>Transactions per second</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>serv</literal></para>
</entry><entry><para>Average service time, in milliseconds</para>
</entry>
</row><row><entry><para>CPU</para>
</entry><entry><para>Device Type</para>
</entry><entry>
</entry>
</row><row><entry>
</entry><entry><para><literal>us</literal></para>
</entry><entry><para>In user mode</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>sy</literal></para>
</entry><entry><para>In system mode</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>wt</literal></para>
</entry><entry><para>Waiting for I/O</para>
</entry>
</row><row><entry>
</entry><entry><para><literal>id</literal></para>
</entry><entry><para>Idle</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><task id="enueb"><title>How to Display Extended Disk Statistics (<command>iostat
-xtc</command>)</title><procedure remap="single-step"><step><para>Run the <command>iostat -xtc</command> command to display extended
disk statistics. </para><screen width="100">$ <userinput>iostat -xtc</userinput>
                  extended device statistics                      tty         cpu
device       r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b  tin tout  us sy wt id
fd0          0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0    0    0   0  0  0 100
sd0          0.0    0.0    0.4    0.4  0.0  0.0   49.5   0   0 
sd6          0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0 
nfs1         0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0 
nfs49        0.0    0.0    0.0    0.0  0.0  0.0   15.1   0   0 
nfs53        0.0    0.0    0.4    0.0  0.0  0.0   24.5   0   0 
nfs54        0.0    0.0    0.0    0.0  0.0  0.0    6.3   0   0 
nfs55        0.0    0.0    0.0    0.0  0.0  0.0    4.9   0   0 </screen><para>The <command>iostat -xtc</command> command displays a line of output
for each disk. The output fields are described in the following list.</para><variablelist><varlistentry><term><literal>r/s</literal></term><listitem><para>Reads per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>w/s</literal></term><listitem><para>Writes per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>kr/s</literal></term><listitem><para>Kbytes read per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>kw/s</literal></term><listitem><para>Kbytes written per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>wait</literal></term><listitem><para>Average number of transactions that are waiting for service
(queue length)</para>
</listitem>
</varlistentry><varlistentry><term><literal>actv</literal></term><listitem><para>Average number of transactions that are actively being serviced</para>
</listitem>
</varlistentry><varlistentry><term><literal>svc_t</literal></term><listitem><para>Average service time, in milliseconds</para>
</listitem>
</varlistentry><varlistentry><term><literal>%w</literal></term><listitem><para>Percentage of time that the queue is not empty</para>
</listitem>
</varlistentry><varlistentry><term><literal>%b</literal></term><listitem><para>Percentage of time that the disk is busy </para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure>
</task>
</sect1><sect1 id="spmonitor-6"><title>Displaying Disk Space Statistics (<command>df</command>)</title><para>Use the <command>df</command> command
to show the amount of free disk space on each mounted disk. The <replaceable>usable</replaceable> disk space that is reported by <command>df</command> reflects
only 90 percent of full capacity, as the reporting statistics allows for 10
percent above the total available space. This <emphasis>head room</emphasis> normally
stays empty for better performance.           </para><para>The percentage of disk space actually reported by the <command>df</command> command
is used space divided by usable space. </para><para>If the file system exceeds 90 percent capacity, you could transfer files
to a disk that is not as full by using the <command>cp</command> command.
Alternately, you could transfer files to a tape by using the <command>tar</command> or <command>cpio</command> commands. Or, you could remove the files.</para><para>For a detailed description of this command, see the <olink targetdoc="refman" targetptr="df-1m" remap="external"><citerefentry><refentrytitle>df</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><task id="enudy"><title>How to Display Disk Space Information (<command>df
-k</command>)</title><procedure remap="single-step"><step><para>Use the <command>df -k</command> command to display disk space
information in Kbytes.</para><screen>$ <userinput>df -k</userinput>
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t3d0s0     192807   40231  133296    24%    / </screen>
</step>
</procedure><example id="spmonitor-7"><title>Displaying File System Information</title><para>The following example shows the output from the <command>df -k</command> command.</para><screen>$ <userinput>df -k</userinput>
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0     254966  204319   25151    90%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                  496808     376  496432     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c0t0d0s6    3325302 3073415  218634    94%    /usr
fd                         0       0       0     0%    /dev/fd
swap                  496472      40  496432     1%    /var/run
swap                  496472      40  496432     1%    /tmp
/dev/dsk/c0t0d0s5      13702    1745   10587    15%    /opt
/dev/dsk/c0t0d0s7       9450    1045    7460    13%    /export/home</screen><para>The following table describes
the output of the <command>df -k</command> command.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>kbytes</literal></para>
</entry><entry><para>Total size of usable space in the file system</para>
</entry>
</row><row><entry><para><literal>used</literal></para>
</entry><entry><para>Amount of space used</para>
</entry>
</row><row><entry><para><literal>avail</literal></para>
</entry><entry><para>Amount of space available for use</para>
</entry>
</row><row><entry><para><literal>capacity</literal></para>
</entry><entry><para>Amount of space used, as a percentage of the total capacity</para>
</entry>
</row><row><entry><para><literal>mounted on</literal> </para>
</entry><entry><para>Mount point</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task>
</sect1><sect1 id="enudq"><title>Monitoring System Activities (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="22.70*"/><colspec colwidth="45.85*"/><colspec colwidth="30.44*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Check file access.</para>
</entry><entry><para>Display file access operation status by using the <command>sar</command> command
with the <option>a</option> option.</para>
</entry><entry><para><olink targetptr="enueh" remap="internal">How to Check File Access (sar -a)</olink></para>
</entry>
</row><row><entry><para>Check buffer activity.</para>
</entry><entry><para>Display buffer activity statistics by using the <command>sar</command> command
with the <option>b</option> option.</para>
</entry><entry><para><olink targetptr="enuef" remap="internal">How to Check Buffer Activity (sar -b)</olink></para>
</entry>
</row><row><entry><para>Check system call statistics.</para>
</entry><entry><para>Display system call statistics by using the <command>sar</command> command
with the <option>c</option> option.</para>
</entry><entry><para><olink targetptr="enuel" remap="internal">How to Check System Call Statistics (sar -c)</olink></para>
</entry>
</row><row><entry><para>Check disk activity.</para>
</entry><entry><para>Check disk activity by using the <command>sar</command> command with
the <option>d</option> option.</para>
</entry><entry><para><olink targetptr="enuen" remap="internal">How to Check Disk Activity (sar -d)</olink></para>
</entry>
</row><row><entry><para>Check page-out and memory.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>g</option> option
to display page-out memory freeing activities.</para>
</entry><entry><para><olink targetptr="enueo" remap="internal">How to Check Page-Out and Memory (sar -g)</olink></para>
</entry>
</row><row><entry><para>Check kernel memory allocation.</para>
</entry><entry><para>The kernel memory allocation (KMA) allows a kernel subsystem to allocate
and free memory, as needed. Use the <command>sar</command> command with the <option>k</option> option to check KMA.</para>
</entry><entry><para><olink targetptr="enuep" remap="internal">How to Check Kernel Memory Allocation (sar
-k)</olink></para>
</entry>
</row><row><entry><para>Check interprocess communication.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>m</option> option
to report interprocess communication activities.</para>
</entry><entry><para><olink targetptr="enuev" remap="internal">How to Check Interprocess Communication (sar
-m)</olink></para>
</entry>
</row><row><entry><para>Check page-in activity.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>p</option> option
to report page-in activity.</para>
</entry><entry><para><olink targetptr="enuew" remap="internal">How to Check Page-In Activity (sar -p)</olink></para>
</entry>
</row><row><entry><para>Check queue activity.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>q</option> option
to check the following:</para><itemizedlist><listitem><para>Average queue length while queue is occupied</para>
</listitem><listitem><para>Percentage of time that the queue is occupied</para>
</listitem>
</itemizedlist>
</entry><entry><para><olink targetptr="enuet" remap="internal">How to Check Queue Activity (sar -q)</olink></para>
</entry>
</row><row><entry><para>Check unused memory.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>r</option> option
to report the number of memory pages and swap file disk blocks that are currently
used.</para>
</entry><entry><para><olink targetptr="enuex" remap="internal">How to Check Unused Memory (sar -r)</olink></para>
</entry>
</row><row><entry><para>Check CPU utilization.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>u</option> option
to display CPU utilization statistics.</para>
</entry><entry><para><olink targetptr="enueu" remap="internal">How to Check CPU Utilization (sar -u)</olink></para>
</entry>
</row><row><entry><para>Check system table status.</para>
</entry><entry><itemizedlist><para>Use the <command>sar</command> command with the <option>v</option> option
to report status on the following system tables:</para><listitem><para>Process</para>
</listitem><listitem><para>Inode</para>
</listitem><listitem><para>File</para>
</listitem><listitem><para>Shared memory record</para>
</listitem>
</itemizedlist>
</entry><entry><para><olink targetptr="enuey" remap="internal">How to Check System Table Status (sar -v)</olink></para>
</entry>
</row><row><entry><para>Check swapping activity.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>w</option> option
to check swapping activity.</para>
</entry><entry><para><olink targetptr="enuez" remap="internal">How to Check Swapping Activity (sar -w)</olink></para>
</entry>
</row><row><entry><para>Check terminal activity.</para>
</entry><entry><para>Use the <command>sar</command> command with the <option>y</option> option
to monitor terminal device activity.</para>
</entry><entry><para><olink targetptr="enufb" remap="internal">How to Check Terminal Activity (sar -y)</olink></para>
</entry>
</row><row><entry><para>Check overall system performance.</para>
</entry><entry><para>The <command>sar</command> <option>A</option> command displays statistics
from all options to provide overall system performance information.</para>
</entry><entry><para><olink targetptr="enufe" remap="internal">How to Check Overall System Performance (sar
-A)</olink></para>
</entry>
</row><row><entry><para>Set up automatic data collection.</para>
</entry><entry><itemizedlist><para>To set up your system to collect data automatically and to run the <command>sar</command> commands, do the following:</para><listitem><para>Run the <command>svcadm enable system/sar:default</command> command</para>
</listitem><listitem><para>Edit the <filename>/var/spool/cron/crontabs/sys</filename> file</para>
</listitem>
</itemizedlist>
</entry><entry><para><olink targetptr="spmonitor-96096" remap="internal">How to Set Up Automatic Data Collection</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="spmonitor-8"><title>Monitoring System Activities (<command>sar</command>)</title><itemizedlist><para>Use the <command>sar</command> command
to perform the following tasks:</para><listitem><para>Organize and view data about system activity.</para>
</listitem><listitem><para>Access system activity data on a special request basis.</para>
</listitem><listitem><para>Generate automatic reports to measure and monitor system performance,
as well as special request reports to pinpoint specific performance problems.
For information on how to set up the <command>sar</command> command to run
on your system, as well as a description of these tools, see <olink targetptr="spconcepts-60676" remap="internal">Collecting System Activity Data Automatically
(sar)</olink>.</para>
</listitem>
</itemizedlist><para>For a detailed description of this command, see the <olink targetdoc="refman" targetptr="sar-1" remap="external"><citerefentry><refentrytitle>sar</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para><task id="enueh"><title>How to Check File Access (<command>sar -a</command>)</title><procedure remap="single-step"><step><para>Display file access operation statistics with the <command>sar
-a</command> command.</para><screen>$ <userinput>sar -a</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:00  iget/s namei/s dirbk/s
01:00:00       0       3       0
02:00:00       0       3       0
03:00:00       0       3       0
04:00:00       0       3       0
05:00:00       0       3       0
06:00:00       0       3       0
07:00:00       0       3       0
08:00:00       0       3       0
08:20:01       0       3       0
08:40:00       0       3       0
09:00:00       0       3       0
09:20:01       0      10       0
09:40:01       0       1       0
10:00:02       0       5       0

Average        0       4       0</screen><para>The following list describes the field names and description of operating
system routines that are reported by the <command>sar -a</command> command.</para><variablelist><varlistentry><term><literal>iget/s</literal></term><listitem><para>The number of requests made for inodes that were not in the
directory name look-up cache (DNLC).</para>
</listitem>
</varlistentry><varlistentry><term><literal>namei/s</literal></term><listitem><para>The number of file system path searches per second. If <literal>namei</literal> does not find a directory name in the DNLC, it calls <literal>iget</literal> to
get the inode for either a file or directory. Hence, most <literal>igets</literal> are
the result of DNLC misses.</para>
</listitem>
</varlistentry><varlistentry><term><literal>dirbk/s</literal></term><listitem><para>The number of directory block reads issued per second.</para>
</listitem>
</varlistentry>
</variablelist><para>The larger the reported values for these
operating system routines, the more time the kernel is spending to access
user files. The amount of time reflects how heavily programs and applications
are using the file systems. The <option>a</option> option is helpful for viewing
how  disk-dependent an application is.</para>
</step>
</procedure>
</task><task id="enuef"><title>How to Check Buffer Activity (<command>sar -b</command>)</title><procedure remap="single-step"><step><para>Display buffer activity statistics with the <command>sar -b</command> command. </para><para>The buffer is used to cache metadata. Metadata includes inodes,
cylinder group blocks, and indirect blocks. </para><screen>$ <userinput>sar -b</userinput>
00:00:00 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
01:00:00       0       0     100       0       0      55       0       0</screen>
</step>
</procedure><example id="spmonitor-9"><title>Checking Buffer Activity (<command>sar <option>b</option></command>)</title><para>The following example of <command>sar -b</command> command output
shows that the <literal>%rcache</literal> and <literal>%wcache</literal> buffers
are not causing any slowdowns. All the data is within acceptable limits.</para><screen>$ <userinput>sar -b</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
01:00:00       0       0     100       0       0      94       0       0
02:00:01       0       0     100       0       0      94       0       0
03:00:00       0       0     100       0       0      92       0       0
04:00:00       0       1     100       0       1      94       0       0
05:00:00       0       0     100       0       0      93       0       0
06:00:00       0       0     100       0       0      93       0       0
07:00:00       0       0     100       0       0      93       0       0
08:00:00       0       0     100       0       0      93       0       0
08:20:00       0       1     100       0       1      94       0       0
08:40:01       0       1     100       0       1      93       0       0
09:00:00       0       1     100       0       1      93       0       0
09:20:00       0       1     100       0       1      93       0       0
09:40:00       0       2     100       0       1      89       0       0
10:00:00       0       9     100       0       5      92       0       0
10:20:00       0       0     100       0       0      68       0       0
10:40:00       0       1      98       0       1      70       0       0
11:00:00       0       1     100       0       1      75       0       0

Average        0       1     100       0       1      91       0       0</screen><para>The following table describes the buffer activities that are displayed
by the <option>b</option> option.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>bread/s</literal> </para>
</entry><entry><para>Average number of reads per second that are submitted to the buffer
cache from the disk</para>
</entry>
</row><row><entry><para><literal>lread/s</literal> </para>
</entry><entry><para>Average number of logical reads per second from the buffer cache</para>
</entry>
</row><row><entry><para><literal>%rcache</literal></para>
</entry><entry><para>Fraction of logical reads that are found in the buffer cache (100 %
minus the ratio of <literal>bread/s</literal> to <literal>lread/s</literal>)</para>
</entry>
</row><row><entry><para><literal>bwrit/s</literal> </para>
</entry><entry><para>Average number of physical blocks (512 blocks) that are written from
the buffer cache to disk, per second</para>
</entry>
</row><row><entry><para><literal>lwrit/s</literal> </para>
</entry><entry><para>Average number of logical writes to the buffer cache, per second</para>
</entry>
</row><row><entry><para><literal>%wcache</literal> </para>
</entry><entry><para>Fraction of logical writes that are found in the buffer cache (100 %
minus the ratio of <literal>bwrit/s</literal> to <literal>lwrit/s</literal>)</para>
</entry>
</row><row><entry><para><literal>pread/s</literal></para>
</entry><entry><para>Average number of physical reads, per second, that use character device
interfaces</para>
</entry>
</row><row><entry><para><literal>pwrit/s</literal></para>
</entry><entry><para>Average number of physical write requests, per second, that use character
device interfaces</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>The most important entries are the cache hit ratios <literal>%rcache</literal> and <literal>%wcache</literal>. These entries measure the effectiveness of system buffering.
If <literal>%rcache</literal> falls below 90 percent, or if <literal>%wcache</literal> falls
below 65 percent, it might be possible to improve performance by increasing
the buffer space.</para>
</example>
</task><task id="enuel"><title>How to Check System Call Statistics (<command>sar
-c</command>)</title><procedure remap="single-step"><step><para>Display system call statistics by using the <command>sar -c</command> command.</para><screen>$ <userinput>sar -c</userinput>
00:00:00 scall/s sread/s swrit/s  fork/s  exec/s rchar/s wchar/s
01:00:00      38       2       2    0.00    0.00     149     120</screen>
</step>
</procedure><example id="spmonitor-10"><title>Checking System Call Statistics (<command>sar <option>c</option></command>)</title><para>The following example shows output from the <command>sar -c</command> command.</para><screen>$ <userinput>sar -c</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 scall/s sread/s swrit/s  fork/s  exec/s rchar/s wchar/s
01:00:00      89      14       9    0.01    0.00    2906    2394
02:00:01      89      14       9    0.01    0.00    2905    2393
03:00:00      89      14       9    0.01    0.00    2908    2393
04:00:00      90      14       9    0.01    0.00    2912    2393
05:00:00      89      14       9    0.01    0.00    2905    2393
06:00:00      89      14       9    0.01    0.00    2905    2393
07:00:00      89      14       9    0.01    0.00    2905    2393
08:00:00      89      14       9    0.01    0.00    2906    2393
08:20:00      90      14       9    0.01    0.01    2914    2395
08:40:01      90      14       9    0.01    0.00    2914    2396
09:00:00      90      14       9    0.01    0.01    2915    2396
09:20:00      90      14       9    0.01    0.01    2915    2396
09:40:00     880     207     156    0.08    0.08   26671    9290
10:00:00    2020     530     322    0.14    0.13   57675   36393
10:20:00     853     129      75    0.02    0.01   10500    8594
10:40:00    2061     524     450    0.08    0.08  579217  567072
11:00:00    1658     404     350    0.07    0.06 1152916 1144203

Average      302      66      49    0.02    0.01   57842   55544</screen><para>The following table describes the system call
categories that are reported by the <option>c</option> option. Typically,
reads and writes account for about half of the total system calls. However,
the percentage varies greatly with the activities that are being performed
by the system.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>scall/s</literal></para>
</entry><entry><para>The number of all types of system calls per second, which is generally
about 30 per second on a system with 4 to 6 users.</para>
</entry>
</row><row><entry><para><literal>sread/s</literal></para>
</entry><entry><para>The number of <literal>read</literal> system calls per second.</para>
</entry>
</row><row><entry><para><literal>swrit/s</literal></para>
</entry><entry><para>The number of <literal>write</literal> system calls per second.</para>
</entry>
</row><row><entry><para><literal>fork/s</literal></para>
</entry><entry><para>The number of <literal>fork</literal> system calls per second, which
is about 0.5 per second on a system with 4 to 6 users. This number increases
if shell scripts are running.</para>
</entry>
</row><row><entry><para><literal>exec/s</literal></para>
</entry><entry><para>The number of <literal>exec</literal> system calls per second. If <literal>exec/s</literal> divided by <literal>fork/s</literal> is greater than 3, look
for inefficient <literal>PATH</literal> variables.</para>
</entry>
</row><row><entry><para><literal>rchar/s</literal> </para>
</entry><entry><para>The number of characters (bytes) transferred by <literal>read</literal> system
calls per second.</para>
</entry>
</row><row><entry><para><literal>wchar/s</literal></para>
</entry><entry><para>The number of characters (bytes) transferred by <literal>write</literal> system
calls per second.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><task id="enuen"><title>How to Check Disk Activity (<command>sar -d</command>)</title><procedure remap="single-step"><step><para>Display disk activity statistics with the <command>sar -d</command> command.</para><screen>$ <userinput>sar -d</userinput>

00:00:00   device        %busy   avque   r+w/s  blks/s  avwait  avserv</screen>
</step>
</procedure><example id="spmonitor-11"><title>Checking Disk Activity</title><para>This abbreviated example illustrates the output from the <command>sar
-d</command> command.</para><screen>$ <userinput>sar -d</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

12:36:32   device        %busy   avque   r+w/s  blks/s  avwait  avserv

12:40:01   dad1             15     0.7      26     399    18.1    10.0
           dad1,a           15     0.7      26     398    18.1    10.0
           dad1,b            0     0.0       0       1     1.0     3.0
           dad1,c            0     0.0       0       0     0.0     0.0
           dad1,h            0     0.0       0       0     0.0     6.0
           fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           nfs2              1     0.0       1      12     0.0    13.2
           nfs3              0     0.0       0       2     0.0     1.9
           nfs4              0     0.0       0       0     0.0     7.0
           nfs5              0     0.0       0       0     0.0    57.1
           nfs6              1     0.0       6     125     4.3     3.2
           nfs7              0     0.0       0       0     0.0     6.0
           sd1               0     0.0       0       0     0.0     5.4
           ohci0,bu          0     0.0       0       0     0.0     0.0
           ohci0,ct          0     0.0       0       0     0.0     0.0
           ohci0,in          0     0.0       7       0     0.0     0.0
           ohci0,is          0     0.0       0       0     0.0     0.0
           ohci0,to          0     0.0       7       0     0.0     0.0</screen><para>The following table describes the disk device activities that are reported
by the <option>d</option> option.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>device</literal></para>
</entry><entry><para>Name of the disk device that is being monitored.</para>
</entry>
</row><row><entry><para><literal>%busy</literal> </para>
</entry><entry><para>Portion of time the device was busy servicing a transfer request.</para>
</entry>
</row><row><entry><para><literal>avque</literal></para>
</entry><entry><para>Average number of requests during the time the device was busy servicing
a transfer request.</para>
</entry>
</row><row><entry><para><literal>r+w/s</literal></para>
</entry><entry><para>Number of read-and-write transfers to the device, per second.</para>
</entry>
</row><row><entry><para><literal>blks/s</literal></para>
</entry><entry><para>Number of 512-byte blocks that are transferred to the device, per second.</para>
</entry>
</row><row><entry><para><literal>avwait</literal> </para>
</entry><entry><para>Average time, in milliseconds, that transfer requests wait idly in the
queue. This time is measured only when the queue is occupied.</para>
</entry>
</row><row><entry><para><literal>avserv</literal> </para>
</entry><entry><para>Average time, in milliseconds, for a transfer request to be completed
by the device. For disks, this value includes seek times, rotational latency
times, and data transfer times.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>Note that queue lengths and wait times are measured when something is
in the queue. If <literal>%busy</literal> is small, large queues and service
times probably represent the periodic efforts by the system to ensure that
altered blocks are promptly written to the disk.</para>
</example>
</task><task id="enueo"><title>How to Check Page-Out and Memory (<command>sar -g</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -g</command> command to display page-out
and memory freeing activities in averages. </para><screen>$ <userinput>sar -g</userinput>
00:00:00  pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
01:00:00     0.00     0.00     0.00     0.00     0.00</screen><para>The output displayed by the <command>sar -g</command> command is a good
indicator of whether more memory might be needed. Use the <command>ps -elf</command> command
to show the number of cycles that are used by the <command>page</command> daemon.
A high number of cycles, combined with high values for the <literal>pgfree/s</literal> and <literal>pgscan/s</literal> fields, indicates a memory shortage. </para><para>The <command>sar -g</command> command also shows whether inodes are being recycled too
quickly and causing a loss of reusable pages. </para>
</step>
</procedure><example id="spmonitor-12"><title>Checking Page-Out and Memory (<command>sar -g</command>)</title><para>The following example shows output from the <command>sar -g</command> command.</para><screen>$ <userinput>sar -g</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:00  pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
01:00:00     0.00     0.00     0.00     0.00     0.00
02:00:00     0.01     0.01     0.01     0.00     0.00
03:00:00     0.00     0.00     0.00     0.00     0.00
04:00:00     0.00     0.00     0.00     0.00     0.00
05:00:00     0.00     0.00     0.00     0.00     0.00
06:00:00     0.00     0.00     0.00     0.00     0.00
07:00:00     0.00     0.00     0.00     0.00     0.00
08:00:00     0.00     0.00     0.00     0.00     0.00
08:20:01     0.00     0.00     0.00     0.00     0.00
08:40:00     0.00     0.00     0.00     0.00     0.00
09:00:00     0.00     0.00     0.00     0.00     0.00
09:20:01     0.05     0.52     1.62    10.16     0.00
09:40:01     0.03     0.44     1.47     4.77     0.00
10:00:02     0.13     2.00     4.38    12.28     0.00
10:20:03     0.37     4.68    12.26    33.80     0.00

Average      0.02     0.25     0.64     1.97     0.00</screen><para>The following table describes the output from the <option>g</option> option.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>pgout/s</literal></para>
</entry><entry><para>The number of page-out requests per second.</para>
</entry>
</row><row><entry><para><literal>ppgout/s</literal> </para>
</entry><entry><para>The actual number of pages that are paged-out, per second. A single
page-out request might involve paging-out multiple pages.</para>
</entry>
</row><row><entry><para><literal>pgfree/s</literal> </para>
</entry><entry><para>The number of pages, per second, that are placed on the free list.</para>
</entry>
</row><row><entry><para><literal>pgscan/s</literal> </para>
</entry><entry><para>The number of pages, per second, that are scanned by the <command>page</command> daemon.
If this value is high, the <command>page</command> daemon is spending a lot
of time checking for free memory. This situation implies that more memory
might be needed. </para>
</entry>
</row><row><entry><para><literal>%ufs_ipf</literal></para>
</entry><entry><para>The percentage of <literal>ufs</literal> inodes taken off the free list
by <literal>iget</literal> that had reusable pages associated with them. These
pages are flushed and cannot be reclaimed by processes. Thus, this field represents
the percentage of <literal>igets</literal> with page flushes. A high value
indicates that the free list of inodes is page-bound, and that the number
of <literal>ufs</literal> inodes might need to be increased. </para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><sect2 id="enueq"><title>Checking Kernel Memory Allocation</title><para>The KMA allows a kernel subsystem to allocate and free memory, as needed. </para><itemizedlist><para>Rather than statically allocating the maximum amount of memory it is
expected to require under peak load, the KMA divides requests for memory into
three categories:</para><listitem><para>Small (less than 256 bytes)</para>
</listitem><listitem><para>Large (512 bytes to 4 Kbytes)</para>
</listitem><listitem><para>Oversized (greater than 4 Kbytes)</para>
</listitem>
</itemizedlist><para>The KMA keeps two pools of memory to satisfy small requests and large
requests. The oversized requests are satisfied by allocating memory from the
system page allocator. </para><para>If you are checking a system that is being used to write drivers or
STREAMS that use KMA resources, then the <command>sar -k</command> command
will likely prove useful. Otherwise, you will probably not need the information
it provides. Any driver or module that uses KMA resources, but does not specifically
return the resources before it exits, can create a memory leak. A memory leak
causes the amount of memory that is allocated by KMA to increase over time.
Thus, if the <literal>alloc</literal> fields of the <command>sar -k</command> command
increase steadily over time, there might be a memory leak. Another indication
of a memory leak is failed requests. If this problem occurs, a memory leak
has probably caused KMA to be unable to reserve and allocate memory. </para><para>If it appears that a memory leak has occurred, you should check any
drivers or STREAMS that might have requested memory from KMA and not returned
it. </para>
</sect2><task id="enuep"><title>How to Check Kernel Memory Allocation (<command>sar
-k</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -k</command> command to report on the following
activities of the Kernel Memory Allocator (KMA). </para><screen width="100">$ <userinput>sar -k</userinput>
00:00:00 sml_mem   alloc  fail  lg_mem   alloc   fail  ovsz_alloc  fail
01:00:00 2523136 1866512     0 18939904 14762364    0      360448     0
02:00:02 2523136 1861724     0 18939904 14778748    0      360448     0</screen>
</step>
</procedure><example id="spmonitor-13"><title>Checking Kernel Memory Allocation (<command>sar <option>k</option></command>)</title><para>The following is an abbreviated example of <command>sar -k</command> output.
 </para><screen>$ <userinput>sar -k</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 sml_mem   alloc  fail  lg_mem   alloc  fail  ovsz_alloc  fail
01:00:00 6119744 4852865     0 60243968 54334808   156     9666560     0
02:00:01 6119744 4853057     0 60243968 54336088   156     9666560     0
03:00:00 6119744 4853297     0 60243968 54335760   156     9666560     0
04:00:00 6119744 4857673     0 60252160 54375280   156     9666560     0
05:00:00 6119744 4858097     0 60252160 54376240   156     9666560     0
06:00:00 6119744 4858289     0 60252160 54375608   156     9666560     0
07:00:00 6119744 4858793     0 60252160 54442424   156     9666560     0
08:00:00 6119744 4858985     0 60252160 54474552   156     9666560     0
08:20:00 6119744 4858169     0 60252160 54377400   156     9666560     0
08:40:01 6119744 4857345     0 60252160 54376880   156     9666560     0
09:00:00 6119744 4859433     0 60252160 54539752   156     9666560     0
09:20:00 6119744 4858633     0 60252160 54410920   156     9666560     0
09:40:00 6127936 5262064     0 60530688 55619816   156     9666560     0
10:00:00 6545728 5823137     0 62996480 58391136   156     9666560     0
10:20:00 6545728 5758997     0 62996480 57907400   156     9666560     0
10:40:00 6734144 6035759     0 64389120 59743064   156    10493952     0
11:00:00 6996288 6394872     0 65437696 60935936   156    10493952     0

Average  6258044 5150556     0 61138340 55609004   156     9763900     0</screen><para>The following table describes the output from the <option>k</option> option.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>sml_mem</literal></para>
</entry><entry><para>The amount of memory, in bytes, that the KMA has available in the small
memory request pool. In this pool, here a small request is less than 256 bytes.</para>
</entry>
</row><row><entry><para><literal>alloc</literal> </para>
</entry><entry><para>The amount of memory, in bytes, that the KMA has allocated from its
small memory request pool to small memory requests.</para>
</entry>
</row><row><entry><para><literal>fail</literal></para>
</entry><entry><para>The number of requests for small amounts of memory that failed.</para>
</entry>
</row><row><entry><para><literal>lg_mem</literal></para>
</entry><entry><para>The amount of memory, in bytes, that the KMA has available in the large
memory request pool. In this pool, a large request is from 512 bytes to 4
Kbytes.</para>
</entry>
</row><row><entry><para><literal>alloc</literal></para>
</entry><entry><para>The amount of memory, in bytes, that the KMA has allocated from its
large memory request pool to large memory requests.</para>
</entry>
</row><row><entry><para><literal>fail</literal> </para>
</entry><entry><para>The number of failed requests for large amounts of memory.</para>
</entry>
</row><row><entry><para><literal>ovsz_alloc</literal></para>
</entry><entry><para>The amount of memory that is allocated for oversized requests, which
are requests that are greater than 4 Kbytes. These requests are satisfied
by the page allocator. Thus, there is no pool.</para>
</entry>
</row><row><entry><para><literal>fail</literal> </para>
</entry><entry><para>The number of failed requests for oversized amounts of memory.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><task id="enuev"><title>How to Check Interprocess Communication (<command>sar
-m</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -m</command> command
to report interprocess communication activities.  </para><screen>$ <userinput>sar -m</userinput>
00:00:00   msg/s  sema/s
01:00:00    0.00    0.00</screen><para>These figures are usually zero (0.00), unless you are running applications
that use messages or semaphores. </para><para>The following list describes
the output from the <option>m</option> option.</para><variablelist><varlistentry><term><literal>msg/s</literal></term><listitem><para>The number of message operations (sends and receives) per
second</para>
</listitem>
</varlistentry><varlistentry><term><literal>sema/s</literal></term><listitem><para>The number of semaphore operations per second</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="spmonitor-14"><title>Checking Interprocess Communication (<command>sar -m</command>)</title><para>The following abbreviated example shows output from the <command>sar
-m</command> command.</para><screen>$ <userinput>sar -m</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:00   msg/s  sema/s
01:00:00    0.00    0.00
02:00:02    0.00    0.00
03:00:00    0.00    0.00
04:00:00    0.00    0.00
05:00:01    0.00    0.00
06:00:00    0.00    0.00

Average     0.00    0.00</screen>
</example>
</task><task id="enuew"><title>How to Check Page-In Activity (<command>sar -p</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -p</command> command
to report page-in activity, which includes protection and translation faults.</para><screen>$ <userinput>sar -p</userinput>
00:00:00  atch/s  pgin/s ppgin/s  pflt/s  vflt/s slock/s
01:00:00    0.07    0.00    0.00    0.21    0.39    0.00</screen>
</step>
</procedure><example id="spmonitor-15"><title>Checking Page-In Activity (<command>sar <option>p</option></command>)</title><para>The following example shows output from the <command>sar <option>p</option></command> command. </para><screen>$ <userinput>sar -p</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04  atch/s  pgin/s ppgin/s  pflt/s  vflt/s slock/s
01:00:00    0.09    0.00    0.00    0.78    2.02    0.00
02:00:01    0.08    0.00    0.00    0.78    2.02    0.00
03:00:00    0.09    0.00    0.00    0.81    2.07    0.00
04:00:00    0.11    0.01    0.01    0.86    2.18    0.00
05:00:00    0.08    0.00    0.00    0.78    2.02    0.00
06:00:00    0.09    0.00    0.00    0.78    2.02    0.00
07:00:00    0.08    0.00    0.00    0.78    2.02    0.00
08:00:00    0.09    0.00    0.00    0.78    2.02    0.00
08:20:00    0.11    0.00    0.00    0.87    2.24    0.00
08:40:01    0.13    0.00    0.00    0.90    2.29    0.00
09:00:00    0.11    0.00    0.00    0.88    2.24    0.00
09:20:00    0.10    0.00    0.00    0.88    2.24    0.00
09:40:00    2.91    1.80    2.38    4.61   17.62    0.00
10:00:00    2.74    2.03    3.08    8.17   21.76    0.00
10:20:00    0.16    0.04    0.04    1.92    2.96    0.00
10:40:00    2.10    2.50    3.42    6.62   16.51    0.00
11:00:00    3.36    0.87    1.35    3.92   15.12    0.00

Average     0.42    0.22    0.31    1.45    4.00    0.00</screen><para>The following table describes the reported statistics from the <option>p</option> option.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>atch/s</literal> </para>
</entry><entry><para>The number of page faults, per second, that are satisfied by reclaiming
a page currently in memory (attaches per second). Instances include reclaiming
an invalid page from the free list and sharing a page of text that is currently
being used by another process. An example is two or more processes that are
accessing the same program text.</para>
</entry>
</row><row><entry><para><literal>pgin/s</literal></para>
</entry><entry><para>The number of times, per second, that file systems receive page-in requests.</para>
</entry>
</row><row><entry><para><literal>ppgin/s</literal> </para>
</entry><entry><para>The number of pages paged in, per second. A single page-in request,
such as a soft-lock request (see <literal>slock/s</literal>) or a large block
size, might involve paging-in multiple pages.</para>
</entry>
</row><row><entry><para><literal>pflt/s</literal> </para>
</entry><entry><para>The number of page faults from protection errors. Instances of protection
faults indicate illegal access to a page and &ldquo;copy-on-writes.&rdquo;
Generally, this number consists primarily of &ldquo;copy-on-writes.&rdquo;</para>
</entry>
</row><row><entry><para><literal>vflt/s</literal>  </para>
</entry><entry><para>The number of address translation page faults, per second. These faults
are known as validity faults. Validity faults occur when a valid process table
entry does not exist for a given virtual address.</para>
</entry>
</row><row><entry><para><literal>slock/s</literal> </para>
</entry><entry><para>The number of faults, per second, caused by software lock requests that
require physical I/O. An example of the occurrence of a soft-lock request
is the transfer of data from a disk to memory. The system locks the page that
is to receive the data so that the page cannot be claimed and used by another
process. </para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><task id="enuet"><title>How to Check Queue Activity (<command>sar -q</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar <option>q</option></command> command
to report the following information: </para><itemizedlist><listitem><para>The Average queue length while the queue is occupied.</para>
</listitem><listitem><para>The percentage of time that the queue is occupied.</para>
</listitem>
</itemizedlist><screen>$ <userinput>sar -q</userinput>
00:00:00 runq-sz %runocc swpq-sz %swpocc</screen><para>The following list describes the output from the <option>q</option> option.</para><variablelist><varlistentry><term><literal>runq-sz</literal></term><listitem><para>The number of kernel threads in memory that are waiting for
a CPU to run. Typically, this value should be less than 2. Consistently higher
values mean that the system might be CPU-bound.</para>
</listitem>
</varlistentry><varlistentry><term><literal>%runocc</literal></term><listitem><para>The percentage of time that the dispatch queues are occupied.</para>
</listitem>
</varlistentry><varlistentry><term><literal>swpq-sz</literal></term><listitem><para>No longer reported by the <command>sar</command> command.</para>
</listitem>
</varlistentry><varlistentry><term><literal>%swpocc</literal></term><listitem><para>No longer reported by the <command>sar</command> command.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="spmonitor-16"><title>Checking Queue Activity</title><para>The following example shows output from the <command>sar -q</command> command.
If the <literal>%runocc</literal> value is high (greater than 90 percent)
and the <literal>runq-sz</literal> value is greater than 2, the CPU is heavily
loaded and response is degraded. In this case, additional CPU capacity might
be required to obtain acceptable system response.   </para><screen>$ <userinput>sar -q</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 runq-sz %runocc swpq-sz %swpocc
01:00:00     1.0       0     0.0       0
02:00:01     1.3       0     0.0       0
03:00:00     1.0       0     0.0       0
04:00:00     1.0       0     0.0       0
05:00:00     1.0       0     0.0       0
06:00:00     2.0       0     0.0       0
07:00:00     0.0       0     0.0       0
08:00:00     1.0       0     0.0       0
08:20:00     1.0       0     0.0       0
08:40:01     2.0       0     0.0       0
09:00:00     0.0       0     0.0       0
09:20:00     1.0       0     0.0       0
09:40:00     1.2       2     0.0       0
10:00:00     1.2       2     0.0       0
10:20:00     1.0       1     0.0       0
10:40:00     1.3       9     0.0       0
11:00:00     1.2       7     0.0       0

Average      1.2       1     0.0       0</screen>
</example>
</task><task id="enuex"><title>How to Check Unused Memory (<command>sar -r</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -r</command> command
to report the number of memory pages and swap-file disk blocks that are currently
unused.  </para><screen>$ <userinput>sar -r</userinput>
00:00:00 freemem freeswap
01:00:00    2135   401922</screen><para>The following list describes the output from the <option>r</option> option.</para><variablelist><varlistentry><term><literal>freemem</literal></term><listitem><para>The average number of memory pages that are available to user
processes over the intervals sampled by the command. Page size is machine-dependent.</para>
</listitem>
</varlistentry><varlistentry><term><literal>freeswap</literal></term><listitem><para>The number of 512-byte disk blocks that are available for
page swapping.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="spmonitor-17"><title>Checking Unused Memory (<command>sar <option>r</option></command>)</title><para>The following example shows output from the <command>sar -r</command> command.</para><screen>$ <userinput>sar -r</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 freemem freeswap
01:00:00   44717  1715062
02:00:01   44733  1715496
03:00:00   44715  1714746
04:00:00   44751  1715403
05:00:00   44784  1714743
06:00:00   44794  1715186
07:00:00   44793  1715159
08:00:00   44786  1714914
08:20:00   44805  1715576
08:40:01   44797  1715347
09:00:00   44761  1713948
09:20:00   44802  1715478
09:40:00   41770  1682239
10:00:00   35401  1610833
10:20:00   34295  1599141
10:40:00   33943  1598425
11:00:00   30500  1561959

Average    43312  1699242</screen>
</example>
</task><task id="enueu"><title>How to Check CPU Utilization (<command>sar -u</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -u</command> command
to display CPU utilization statistics.  </para><screen>$ <userinput>sar -u</userinput>
00:00:00    %usr    %sys    %wio   %idle
01:00:00       0       0       0     100</screen><para>The <command>sar</command> command without any options is equivalent
to the <command>sar -u</command> command. At any given moment, the processor
is either busy or idle. When busy, the processor is in either user mode or
system mode. When idle, the processor is either waiting for I/O completion
or &ldquo;sitting still&rdquo; with no work to do. </para><para>The following
list describes output from the <option>u</option> option.</para><variablelist><varlistentry><term><literal>%usr</literal></term><listitem><para>Lists the percentage of time that the processor is in user
mode</para>
</listitem>
</varlistentry><varlistentry><term><literal>%sys</literal></term><listitem><para>Lists the percentage of time that the processor is in system
mode</para>
</listitem>
</varlistentry><varlistentry><term><literal>%wio</literal></term><listitem><para>Lists the percentage of time that the processor is idle and
waiting for I/O completion</para>
</listitem>
</varlistentry><varlistentry><term><literal>%idle</literal></term><listitem><para>Lists the percentage of time that the processor is idle and
not waiting for I/O</para>
</listitem>
</varlistentry>
</variablelist><para>A high <literal>%wio</literal> value generally means that a disk slowdown
has occurred. </para>
</step>
</procedure><example id="spmonitor-18"><title>Checking CPU Utilization (<command>sar -u</command>)</title><para>The following example shows output from the <command>sar -u</command> command. </para><screen>$ <userinput>sar -u</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04    %usr    %sys    %wio   %idle
01:00:00       0       0       0     100
02:00:01       0       0       0     100
03:00:00       0       0       0     100
04:00:00       0       0       0     100
05:00:00       0       0       0     100
06:00:00       0       0       0     100
07:00:00       0       0       0     100
08:00:00       0       0       0     100
08:20:00       0       0       0      99
08:40:01       0       0       0      99
09:00:00       0       0       0      99
09:20:00       0       0       0      99
09:40:00       4       1       0      95
10:00:00       4       2       0      94
10:20:00       1       1       0      98
10:40:00      18       3       0      79
11:00:00      25       3       0      72

Average        2       0       0      98</screen>
</example>
</task><task id="enuey"><title>How to Check System Table Status (<command>sar -v</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -v</command> command
to report the status of the process table, inode table, file table, and shared
memory record table.  </para><screen>$ <userinput>sar -v</userinput>
00:00:00  proc-sz    ov  inod-sz    ov  file-sz    ov   lock-sz
01:00:00   43/922     0 2984/4236    0  322/322     0    0/0   </screen>
</step>
</procedure><example id="spmonitor-19"><title>Checking System Table Status (<command>sar <option>v</option></command>)</title><para>The following abbreviated example shows output from the <command>sar
-v</command> command. This example shows that all tables are large enough
to have no overflows. These tables are all dynamically allocated based on
the amount of physical memory.</para><screen>$ <userinput>sar -v</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04  proc-sz    ov  inod-sz    ov  file-sz    ov   lock-sz
01:00:00   69/8010    0 3476/34703    0    0/0       0    0/0   
02:00:01   69/8010    0 3476/34703    0    0/0       0    0/0   
03:00:00   69/8010    0 3476/34703    0    0/0       0    0/0   
04:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
05:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
06:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
07:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
08:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
08:20:00   69/8010    0 3494/34703    0    0/0       0    0/0   
08:40:01   69/8010    0 3494/34703    0    0/0       0    0/0   
09:00:00   69/8010    0 3494/34703    0    0/0       0    0/0   
09:20:00   69/8010    0 3494/34703    0    0/0       0    0/0   
09:40:00   74/8010    0 3494/34703    0    0/0       0    0/0   
10:00:00   75/8010    0 4918/34703    0    0/0       0    0/0   
10:20:00   72/8010    0 4918/34703    0    0/0       0    0/0   
10:40:00   71/8010    0 5018/34703    0    0/0       0    0/0   
11:00:00   77/8010    0 5018/34703    0    0/0       0    0/0  </screen><para>Output from the <option>v</option> option is described in the following
table.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>proc-sz</literal></para>
</entry><entry><para>The number of process entries (<literal>proc</literal> structures) that
are currently being used, or allocated, in the kernel.</para>
</entry>
</row><row><entry><para><literal>inod-sz</literal></para>
</entry><entry><para>The total number of inodes in memory compared to the maximum number
of inodes that are allocated in the kernel.  This number is not a strict high
watermark. The number can overflow.</para>
</entry>
</row><row><entry><para><literal>file-sz</literal> </para>
</entry><entry><para>The size of the open system file table. The <literal>sz</literal> is
given as <literal>0</literal>, because space is allocated dynamically for
the file table.</para>
</entry>
</row><row><entry><para><literal>ov</literal> </para>
</entry><entry><para>The overflows that occur between sampling points for each table. </para>
</entry>
</row><row><entry><para><literal>lock-sz</literal></para>
</entry><entry><para>The number of shared memory record table entries that are currently
being used, or allocated, in the kernel. The <literal>sz</literal> is given
as <literal>0</literal> because space is allocated dynamically for the shared
memory record table.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example>
</task><task id="enuez"><title>How to Check Swapping Activity (<command>sar -w</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -w</command> command to report swapping and
switching activity.</para><screen>$ <userinput>sar -w</userinput>
00:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s
01:00:00    0.00     0.0    0.00     0.0      22</screen><para>The following list describes target values and observations related
to the <command>sar <option>w</option></command> command output.</para><variablelist><varlistentry><term><literal>swpin/s</literal></term><listitem><para>The number of LWP transfers into memory per second.</para>
</listitem>
</varlistentry><varlistentry><term><literal>bswin/s</literal></term><listitem><para>The number of blocks transferred for swap-ins per second. <literal>/* (float)PGTOBLK(xx->cvmi.pgswapin) / sec_diff */</literal></para>
</listitem>
</varlistentry><varlistentry><term><literal>swpot/s</literal></term><listitem><para>The average number of processes that are swapped out of memory
per second. If the number is greater than 1, you might need to increase memory.</para>
</listitem>
</varlistentry><varlistentry><term><literal>bswot/s</literal></term><listitem><para>The number of blocks that are transferred for swap-outs per
second.</para>
</listitem>
</varlistentry><varlistentry><term><literal>pswch/s</literal></term><listitem><para>The number of kernel thread switches, per second.</para>
</listitem>
</varlistentry>
</variablelist><note><para>All process swap-ins include process initialization.</para>
</note>
</step>
</procedure><example id="spmonitor-20"><title>Checking Swap Activity (<command>sar <option>w</option></command>)</title><para>The following example shows output from the <command>sar -w</command> command. </para><screen>$ <userinput>sar -w</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 swpin/s bswin/s swpot/s bswot/s pswch/s
01:00:00    0.00     0.0    0.00     0.0     132
02:00:01    0.00     0.0    0.00     0.0     133
03:00:00    0.00     0.0    0.00     0.0     133
04:00:00    0.00     0.0    0.00     0.0     134
05:00:00    0.00     0.0    0.00     0.0     133
06:00:00    0.00     0.0    0.00     0.0     133
07:00:00    0.00     0.0    0.00     0.0     132
08:00:00    0.00     0.0    0.00     0.0     131
08:20:00    0.00     0.0    0.00     0.0     133
08:40:01    0.00     0.0    0.00     0.0     132
09:00:00    0.00     0.0    0.00     0.0     132
09:20:00    0.00     0.0    0.00     0.0     132
09:40:00    0.00     0.0    0.00     0.0     335
10:00:00    0.00     0.0    0.00     0.0     601
10:20:00    0.00     0.0    0.00     0.0     353
10:40:00    0.00     0.0    0.00     0.0     747
11:00:00    0.00     0.0    0.00     0.0     804

Average     0.00     0.0    0.00     0.0     198</screen>
</example>
</task><task id="enufb"><title>How to Check Terminal Activity (<command>sar -y</command>)</title><procedure remap="single-step"><step><para>Use
the <command>sar -y</command> command to monitor terminal device activities. </para><screen>$ <userinput>sar -y</userinput>
00:00:00 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
01:00:00       0       0       0       0       0       0</screen><para>If you have a lot of terminal I/O, you can use this report to determine
if any bad lines exist. The activities recorded are defined in the following
list.</para><variablelist><varlistentry><term><literal>rawch/s</literal></term><listitem><para>Input characters (raw queue) per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>canch/s</literal></term><listitem><para>Input characters that are processed by canon (canonical queue)
per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>outch/s</literal></term><listitem><para>Output characters (output queue) per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>rcvin/s</literal></term><listitem><para>Receiver hardware interrupts per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>xmtin/s</literal></term><listitem><para>Transmitter hardware interrupts per second</para>
</listitem>
</varlistentry><varlistentry><term><literal>mdmin/s</literal></term><listitem><para>Modem interrupts per second</para>
</listitem>
</varlistentry>
</variablelist><para>The number of modem interrupts per second (<literal>mdmin/s</literal>)
should be close to zero. The receive and transmit interrupts per second (<literal>xmtin/s</literal> and <literal>rcvin/s</literal>) should be less than or equal
to the number of incoming or outgoing characters, respectively. If  not, check
for bad lines. </para>
</step>
</procedure><example id="spmonitor-21"><title>Checking Terminal Activity (<command>sar -y</command>)</title><para>The following example shows output from the <command>sar -y</command> command.</para><screen>$ <userinput>sar -y</userinput>

SunOS balmyday 5.10 s10_51 sun4u    03/18/2004

00:00:04 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
01:00:00       0       0       0       0       0       0
02:00:01       0       0       0       0       0       0
03:00:00       0       0       0       0       0       0
04:00:00       0       0       0       0       0       0
05:00:00       0       0       0       0       0       0
06:00:00       0       0       0       0       0       0
07:00:00       0       0       0       0       0       0
08:00:00       0       0       0       0       0       0
08:20:00       0       0       0       0       0       0
08:40:01       0       0       0       0       0       0
09:00:00       0       0       0       0       0       0
09:20:00       0       0       0       0       0       0
09:40:00       0       0       1       0       0       0
10:00:00       0       0      37       0       0       0
10:20:00       0       0       0       0       0       0
10:40:00       0       0       3       0       0       0
11:00:00       0       0       3       0       0       0

Average        0       0       1       0       0       0</screen>
</example>
</task><task id="enufe"><title>How to Check Overall System Performance (<command>sar
-A</command>)</title><procedure remap="single-step"><step><para>Use the <command>sar -A</command> command
to display statistics from all options to provide a view of overall system
performance.</para><para>This command provides a more global perspective.
If data from more than a single time segment is shown, the report includes
averages.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="spconcepts-60676"><title>Collecting System Activity Data Automatically
(<command>sar</command>)</title><para>Three commands
are involved in the automatic collection of system activity data: <command>sadc</command>, <command>sa1</command>, and <command>sa2</command>. </para><para>The <command>sadc</command> data collection utility periodically collects
data on system activity and saves the data in a file in binary format, one
file for each 24-hour period. You can set up the <command>sadc</command> command
to run periodically (usually once each hour), and whenever the system boots
to multiuser mode. The data files are placed in the <filename>/var/adm/sa</filename> directory.
Each file is named <filename>sa</filename><replaceable>dd</replaceable>, where <replaceable>dd</replaceable> is the current date. The format of the command is as follows: </para><screen>/usr/lib/sa/sadc [<replaceable>t</replaceable> <replaceable>n</replaceable>] [<replaceable>ofile</replaceable>]</screen><para>The command samples <replaceable>n</replaceable> times with an interval
of <replaceable>t</replaceable> seconds, which should be greater than five
seconds between samples. This command then writes to the binary <replaceable>ofile</replaceable> file, or to standard output.</para><sect2 id="spconcepts-22"><title>Running the <command>sadc</command> Command
When Booting</title><para>The <command>sadc</command> command should be run at system boot
time to record the statistics from when the counters are reset to zero. To
make sure that the <command>sadc</command> command is run at boot time, the <command>svcadm enable system/sar:default</command> command writes a record to the
daily data file.   </para><para>The command entry has the following format:</para><screen>/usr/bin/su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"</screen>
</sect2><sect2 id="spconcepts-50595"><title>Running the <command>sadc</command> Command
Periodically With the <command>sa1</command> Script</title><para>To generate periodic records, you need to run the <command>sadc</command> command regularly. The simplest way to do so is to uncomment
the following lines in the <filename>/var/spool/cron/crontabs/sys</filename> file:
  </para><screen># 0 * * * 0-6 /usr/lib/sa/sa1
# 20,40 8-17 * * 1-5 /usr/lib/sa/sa1
# 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A</screen><itemizedlist><para>The <filename>sys</filename> <filename>crontab</filename> entries do
the following:</para><listitem><para>The first two <filename>crontab</filename> entries cause a
record to be written to the <filename>/var/adm/sa/sa</filename><replaceable>dd</replaceable> file
every 20 minutes from 8 a.m. to 5 p.m., Monday through Friday, and every hour
on the hour otherwise.</para>
</listitem><listitem><para>The third entry writes a record to the <filename>/var/adm/sa/sar</filename><replaceable>dd</replaceable> file hourly, Monday through Friday, and includes all <command>sar</command> options.</para>
</listitem>
</itemizedlist><para>You can change these defaults to meet your needs.</para>
</sect2><sect2 id="spconcepts-23"><title>Producing Reports With the <command>sa2</command> Shell
Script</title><para>Another shell script, <command>sa2</command>,
produces reports rather than binary data files. The <command>sa2</command> command
invokes the <command>sar</command> command and writes the ASCII output to
a report file.   </para>
</sect2><sect2 id="spconcepts-13828"><title>Setting Up Automatic Data Collection (<command>sar</command>)</title><para>The <command>sar</command> command can be used either to gather system activity data itself
or to report what has been collected in the daily activity files that are
created by the <command>sadc</command> command. </para><para>The <command>sar</command> command has the following formats: </para><screen><command>sar</command> [<command>-aAbcdgkmpqruvwy</command>] [<command>-o</command> <replaceable>file</replaceable>] <replaceable>t</replaceable> <replaceable>[n</replaceable>] </screen><screen><command>sar</command> [<command>-aAbcdgkmpqruvw</command>y] [<command>-s</command> <replaceable>time</replaceable>] [<command>-e</command> <replaceable>time</replaceable>] [<command>-i</command> <replaceable>sec</replaceable>] [<command>-f</command> <replaceable>file</replaceable>]</screen><para>The following <command>sar</command> command samples cumulative activity
counters in the operating system every <replaceable>t</replaceable> seconds, <replaceable>n</replaceable> times. The <replaceable>t</replaceable> should be five seconds
or greater. Otherwise, the command itself might affect the sample. You must
specify a time interval in which to take the samples. Otherwise, the command
operates according to the second format. The default value of <replaceable>n</replaceable> is
1. The following example takes two samples separated by 10 seconds. If the <option>o</option> option were specified, samples are saved in binary format.</para><screen>$ <userinput>sar -u 10 2</userinput></screen><itemizedlist><para>Other important information about the <command>sar</command> command
includes the following:</para><listitem><para>With no sampling interval or number
of samples specified, the <command>sar</command> command extracts data from
a previously recorded file. This file is either the file specified by the <option>f</option> option or, by default, the standard daily activity file, <command>/var/adm/sa/sa</command><replaceable>dd</replaceable>, for the most recent day.   </para>
</listitem><listitem><para>The <option>s</option> and <option>e</option> options define the
starting time and the ending time for the report. Starting and ending times
are of the form <replaceable>hh</replaceable>[<replaceable>:mm</replaceable>[<replaceable>:ss</replaceable>]], where <replaceable>hh</replaceable>, <replaceable>mm</replaceable>,
and <replaceable>ss</replaceable> represent hours, minutes, and seconds. </para>
</listitem><listitem><para>The <option>i</option> option specifies,
in seconds, the intervals between record selection. If the <option>i</option> option
is not included, all intervals that are found in the daily activity file are
reported. </para>
</listitem>
</itemizedlist><para>The
following table lists the <command>sar</command> options and their actions.
 </para><table frame="topbot" id="spconcepts-94222"><title>Options for the <command>sar</command> Command</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="72*"/><colspec colname="column2" colwidth="285*"/><thead><row rowsep="1"><entry><para>Option</para>
</entry><entry><para>Actions</para>
</entry>
</row>
</thead><tbody><row><entry><para><option>a</option> </para>
</entry><entry><para>Checks file access operations</para>
</entry>
</row><row><entry><para><option>b</option> </para>
</entry><entry><para>Checks buffer activity </para>
</entry>
</row><row><entry><para><option>c</option> </para>
</entry><entry><para>Checks system calls </para>
</entry>
</row><row><entry><para><option>d</option> </para>
</entry><entry><para>Checks activity for each block device</para>
</entry>
</row><row><entry><para><option>g</option></para>
</entry><entry><para>Checks page-out and memory freeing </para>
</entry>
</row><row><entry><para><option>k</option> </para>
</entry><entry><para>Checks kernel memory allocation </para>
</entry>
</row><row><entry><para><option>m</option> </para>
</entry><entry><para>Checks interprocess communication </para>
</entry>
</row><row><entry><para><option>nv</option> </para>
</entry><entry><para>Checks system table status </para>
</entry>
</row><row><entry><para><option>p</option> </para>
</entry><entry><para>Checks swap and dispatch activity </para>
</entry>
</row><row><entry><para><option>q</option> </para>
</entry><entry><para>Checks queue activity </para>
</entry>
</row><row><entry><para><option>r</option> </para>
</entry><entry><para>Checks unused memory </para>
</entry>
</row><row><entry><para><option>u</option> </para>
</entry><entry><para>Checks CPU utilization</para>
</entry>
</row><row><entry><para><option>w</option> </para>
</entry><entry><para>Checks swapping and switching volume </para>
</entry>
</row><row><entry><para><option>y</option> </para>
</entry><entry><para>Checks terminal activity </para>
</entry>
</row><row><entry><para><option>A</option> </para>
</entry><entry><para>Reports overall system performance, which is the same as entering all
options.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>Using no option is equivalent to calling the <command>sar</command> command
with the <option>u</option> option.</para>
</sect2><task id="spmonitor-96096"><title>How to Set Up Automatic Data Collection</title><procedure>&rolestep.sgm;<step id="spmonitor-step-24"><para>Run the <command>svcadm enable system/sar:default</command> command.</para><para>This version of the <command>sadc</command> command
writes a special record that marks the time when the counters are reset to
zero (boot time).</para>
</step><step id="spmonitor-step-25"><para>Edit the <filename>/var/spool/cron/crontabs/sys</filename> <filename>crontab</filename> file.</para><note><para>Do not edit a <filename>crontab</filename> file directly. Instead,
use the <command>crontab</command> <option>e</option> command to make changes
to an existing <filename>crontab</filename> file.</para>
</note><screen># <userinput>crontab -e sys</userinput></screen>
</step><step><para>Uncomment the following lines:</para><screen>0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A</screen><para>For more information, see the <olink targetdoc="refman" targetptr="crontab-1" remap="external"><citerefentry><refentrytitle>crontab</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</step>
</procedure>
</task>
</sect1>
</chapter>