1.\" Copyright (c) 1985, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)systat.1 8.2 (Berkeley) 12/30/93 33.\" $FreeBSD$ 34.\" 35.Dd September 9, 1997 36.Dt SYSTAT 1 37.Os 38.Sh NAME 39.Nm systat 40.Nd display system statistics on a crt 41.Sh SYNOPSIS 42.Nm 43.Op Fl display 44.Op Ar refresh-interval 45.Sh DESCRIPTION 46The 47.Nm 48utility displays various system statistics in a screen oriented fashion 49using the curses screen display library, 50.Xr ncurses 3 . 51.Pp 52While 53.Nm 54is running the screen is usually divided into two windows (an exception 55is the vmstat display which uses the entire screen). The 56upper window depicts the current system load average. The 57information displayed in the lower window may vary, depending on 58user commands. The last line on the screen is reserved for user 59input and error messages. 60.Pp 61By default 62.Nm 63displays the processes getting the largest percentage of the processor 64in the lower window. Other displays show swap space usage, disk 65.Tn I/O 66statistics (a la 67.Xr iostat 8 ) , 68virtual memory statistics (a la 69.Xr vmstat 8 ) , 70network ``mbuf'' utilization, 71.Tn TCP/IP 72statistics, 73and network connections (a la 74.Xr netstat 1 ) . 75.Pp 76Input is interpreted at two different levels. 77A ``global'' command interpreter processes all keyboard input. 78If this command interpreter fails to recognize a command, the 79input line is passed to a per-display command interpreter. This 80allows each display to have certain display-specific commands. 81.Pp 82Command line options: 83.Bl -tag -width "refresh_interval" 84.It Fl Ns Ar display 85The 86.Fl 87flag expects 88.Ar display 89to be one of: 90.Ic icmp , 91.Ic iostat , 92.Ic ip , 93.Ic mbufs , 94.Ic netstat , 95.Ic pigs , 96.Ic swap , 97.Ic tcp , 98or 99.Ic vmstat . 100These displays can also be requested interactively (without the 101.Dq Fl ) 102and are described in 103full detail below. 104.It Ar refresh-interval 105The 106.Ar refresh-value 107specifies the screen refresh time interval in seconds. 108.El 109.Pp 110Certain characters cause immediate action by 111.Nm . 112These are 113.Bl -tag -width Fl 114.It Ic \&^L 115Refresh the screen. 116.It Ic \&^G 117Print the name of the current ``display'' being shown in 118the lower window and the refresh interval. 119.It Ic \&^Z 120Stop 121.Nm . 122.It Ic \&: 123Move the cursor to the command line and interpret the input 124line typed as a command. While entering a command the 125current character erase, word erase, and line kill characters 126may be used. 127.El 128.Pp 129The following commands are interpreted by the ``global'' 130command interpreter. 131.Bl -tag -width Fl 132.It Ic help 133Print the names of the available displays on the command line. 134.It Ic load 135Print the load average over the past 1, 5, and 15 minutes 136on the command line. 137.It Ic stop 138Stop refreshing the screen. 139.It Xo 140.Op Ic start 141.Op Ar number 142.Xc 143Start (continue) refreshing the screen. If a second, numeric, 144argument is provided it is interpreted as a refresh interval 145(in seconds). 146Supplying only a number will set the refresh interval to this 147value. 148.It Ic quit 149Exit 150.Nm . 151(This may be abbreviated to 152.Ic q . ) 153.El 154.Pp 155The available displays are: 156.Bl -tag -width Ic 157.It Ic pigs 158Display, in the lower window, those processes resident in main 159memory and getting the 160largest portion of the processor (the default display). 161When less than 100% of the 162processor is scheduled to user processes, the remaining time 163is accounted to the ``idle'' process. 164.It Ic icmp 165Display, in the lower window, statistics about messages received and 166transmitted by the Internet Control Message Protocol 167.Pq Dq Tn ICMP . 168The left half of the screen displays information about received 169packets, and the right half displays information regarding transmitted 170packets. 171.Pp 172The 173.Ic icmp 174display understands two commands: 175.Ic mode 176and 177.Ic reset . 178The 179.Ic mode 180command is used to select one of four display modes, given as its argument: 181.Bl -tag -width absoluteXX -compact 182.It Ic rate : 183show the rate of change of each value in packets (the default) 184per second 185.It Ic delta : 186show the rate of change of each value in packets per refresh interval 187.It Ic since : 188show the total change of each value since the display was last reset 189.It Ic absolute : 190show the absolute value of each statistic 191.El 192.Pp 193The 194.Ic reset 195command resets the baseline for 196.Ic since 197mode. The 198.Ic mode 199command with no argument will display the current mode in the command 200line. 201.It Ic ip 202Otherwise identical to the 203.Ic icmp 204display, except that it displays 205.Tn IP 206and 207.Tn UDP 208statistics. 209.It Ic tcp 210Like 211.Ic icmp , 212but with 213.Tn TCP 214statistics. 215.It Ic iostat 216Display, in the lower window, statistics about processor use 217and disk throughput. Statistics on processor use appear as 218bar graphs of the amount of time executing in user mode (``user''), 219in user mode running low priority processes (``nice''), in 220system mode (``system''), in interrupt mode (``interrupt''), 221and idle (``idle''). Statistics 222on disk throughput show, for each drive, megabytes per second, 223average number of disk transactions per second, and 224average kilobytes of data per transaction. This information may be 225displayed as bar graphs or as rows of numbers which scroll downward. Bar 226graphs are shown by default. 227.Pp 228The following commands are specific to the 229.Ic iostat 230display; the minimum unambiguous prefix may be supplied. 231.Pp 232.Bl -tag -width Fl -compact 233.It Cm numbers 234Show the disk 235.Tn I/O 236statistics in numeric form. Values are 237displayed in numeric columns which scroll downward. 238.It Cm bars 239Show the disk 240.Tn I/O 241statistics in bar graph form (default). 242.It Cm kbpt 243Toggle the display of kilobytes per transaction. 244(the default is to 245not display kilobytes per transaction). 246.El 247.It Ic swap 248Show information about swap space usage on all the 249swap areas compiled into the kernel. 250The first column is the device name of the partition. 251The next column is the total space available in the partition. 252The 253.Ar Used 254column indicates the total blocks used so far; 255the graph shows the percentage of space in use on each partition. 256If there are more than one swap partition in use, 257a total line is also shown. 258Areas known to the kernel, but not in use are shown as not available. 259.It Ic mbufs 260Display, in the lower window, the number of mbufs allocated 261for particular uses, i.e. data, socket structures, etc. 262.It Ic vmstat 263Take over the entire display and show a (rather crowded) compendium 264of statistics related to virtual memory usage, process scheduling, 265device interrupts, system name translation cacheing, disk 266.Tn I/O 267etc. 268.Pp 269The upper left quadrant of the screen shows the number 270of users logged in and the load average over the last one, five, 271and fifteen minute intervals. 272Below this line are statistics on memory utilization. 273The first row of the table reports memory usage only among 274active processes, that is processes that have run in the previous 275twenty seconds. 276The second row reports on memory usage of all processes. 277The first column reports on the number of physical pages 278claimed by processes. 279The second column reports the number of physical pages that 280are devoted to read only text pages. 281The third and fourth columns report the same two figures for 282virtual pages, that is the number of pages that would be 283needed if all processes had all of their pages. 284Finally the last column shows the number of physical pages 285on the free list. 286.Pp 287Below the memory display is a list of the 288average number of processes (over the last refresh interval) 289that are runnable (`r'), in page wait (`p'), 290in disk wait other than paging (`d'), 291sleeping (`s'), and swapped out but desiring to run (`w'). 292The row also shows the average number of context switches 293(`Csw'), traps (`Trp'; includes page faults), system calls (`Sys'), 294interrupts (`Int'), network software interrupts (`Sof'), and page 295faults (`Flt'). 296.Pp 297Below the process queue length listing is a numerical listing and 298a bar graph showing the amount of 299system (shown as `='), interrupt (shown as `+'), user (shown as `>'), 300nice (shown as `-'), and idle time (shown as ` '). 301.Pp 302Below the process display are statistics on name translations. 303It lists the number of names translated in the previous interval, 304the number and percentage of the translations that were 305handled by the system wide name translation cache, and 306the number and percentage of the translations that were 307handled by the per process name translation cache. 308.Pp 309At the bottom left is the disk usage display. 310It reports the number of 311kilobytes per transaction, transactions per second, megabytes 312per second and the percentage of the time the disk was busy averaged 313over the refresh period of the display (by default, five seconds). 314The system keeps statistics on most every storage device. In general, up 315to seven devices are displayed. The devices displayed by default are the 316first devices in the kernel's device list. See 317.Xr devstat 3 318and 319.Xr devstat 9 320for details on the devstat system. 321.Pp 322Under the date in the upper right hand quadrant are statistics 323on paging and swapping activity. 324The first two columns report the average number of pages 325brought in and out per second over the last refresh interval 326due to page faults and the paging daemon. 327The third and fourth columns report the average number of pages 328brought in and out per second over the last refresh interval 329due to swap requests initiated by the scheduler. 330The first row of the display shows the average 331number of disk transfers per second over the last refresh interval; 332the second row of the display shows the average 333number of pages transferred per second over the last refresh interval. 334.Pp 335Below the paging statistics is a column of lines regarding the virtual 336memory system which list the average number of 337pages copied on write (`cow'), 338pages zero filled on demand (`zfod'), 339slow (on-the-fly) zero fills percentage (`%slo-z'), 340pages wired down (`wire'), 341active pages (`act'), 342inactive pages (`inact'), 343pages on the buffer cache queue (`cache'), 344number of free pages (`free'), 345pages freed by the page daemon (`daefr'), 346pages freed by exiting processes (`prcfr'), 347pages reactivated from the free list (`react'), 348times the page daemon was awakened (`pdwak'), 349pages analyzed by the page daemon (`pdpgs'), 350and 351intransit blocking page faults (`intrn') 352per second over the refresh interval. 353.Pp 354At the bottom of this column are lines showing the 355amount of memory, in kilobytes, used for the buffer cache (`buf'), 356the number of dirty buffers in the buffer cache (`dirtybuf'), 357desired maximum size of vnode cache (`desiredvnodes') (mostly unused, 358except to size the name cache), 359number of vnodes actually allocated (`numvnodes'), 360and 361number of allocated vnodes that are free (`freevnodes'). 362.Pp 363Running down the right hand side of the display is a breakdown 364of the interrupts being handled by the system. 365At the top of the list is the total interrupts per second 366over the time interval. 367The rest of the column breaks down the total on a device 368by device basis. 369Only devices that have interrupted at least once since boot time are shown. 370.Pp 371The following commands are specific to the 372.Ic vmstat 373display; the minimum unambiguous prefix may be supplied. 374.Pp 375.Bl -tag -width Ar -compact 376.It Cm boot 377Display cumulative statistics since the system was booted. 378.It Cm run 379Display statistics as a running total from the point this 380command is given. 381.It Cm time 382Display statistics averaged over the refresh interval (the default). 383.It Cm want_fd 384Toggle the display of fd devices in the disk usage display. 385.It Cm zero 386Reset running statistics to zero. 387.El 388.It Ic netstat 389Display, in the lower window, network connections. By default, 390network servers awaiting requests are not displayed. Each address 391is displayed in the format ``host.port'', with each shown symbolically, 392when possible. It is possible to have addresses displayed numerically, 393limit the display to a set of ports, hosts, and/or protocols 394(the minimum unambiguous prefix may be supplied): 395.Pp 396.Bl -tag -width Ar -compact 397.It Cm all 398Toggle the displaying of server processes awaiting requests (this 399is the equivalent of the 400.Fl a 401flag to 402.Xr netstat 1 ) . 403.It Cm numbers 404Display network addresses numerically. 405.It Cm names 406Display network addresses symbolically. 407.It Cm proto Ar protocol 408Display only network connections using the indicated 409.Ar protocol . 410Supported protocols are ``tcp'', ``udp'', and ``all''. 411.It Cm ignore Op Ar items 412Do not display information about connections associated with 413the specified hosts or ports. Hosts and ports may be specified 414by name (``vangogh'', ``ftp''), or numerically. Host addresses 415use the Internet dot notation (``128.32.0.9''). Multiple items 416may be specified with a single command by separating them with 417spaces. 418.It Cm display Op Ar items 419Display information about the connections associated with the 420specified hosts or ports. As for 421.Ar ignore , 422.Op Ar items 423may be names or numbers. 424.It Cm show Op Ar ports\&|hosts 425Show, on the command line, the currently selected protocols, 426hosts, and ports. Hosts and ports which are being ignored 427are prefixed with a `!'. If 428.Ar ports 429or 430.Ar hosts 431is supplied as an argument to 432.Cm show , 433then only the requested information will be displayed. 434.It Cm reset 435Reset the port, host, and protocol matching mechanisms to the default 436(any protocol, port, or host). 437.El 438.El 439.Pp 440Commands to switch between displays may be abbreviated to the 441minimum unambiguous prefix; for example, ``io'' for ``iostat''. 442Certain information may be discarded when the screen size is 443insufficient for display. For example, on a machine with 10 444drives the 445.Ic iostat 446bar graph displays only 3 drives on a 24 line terminal. When 447a bar graph would overflow the allotted screen space it is 448truncated and the actual value is printed ``over top'' of the bar. 449.Pp 450The following commands are common to each display which shows 451information about disk drives. These commands are used to 452select a set of drives to report on, should your system have 453more drives configured than can normally be displayed on the 454screen. 455.Pp 456.Bl -tag -width Ar -compact 457.It Cm ignore Op Ar drives 458Do not display information about the drives indicated. Multiple 459drives may be specified, separated by spaces. 460.It Cm display Op Ar drives 461Display information about the drives indicated. Multiple drives 462may be specified, separated by spaces. 463.It Cm only Op Ar drives 464Display only the specified drives. Multiple drives may be specified, 465separated by spaces. 466.It Cm drives 467Display a list of available devices. 468.It Cm match Xo 469.Ar type , Ns Ar if , Ns Ar pass 470.Op | Ar ... 471.Xc 472Display devivces matching the given pattern. The basic matching 473expressions are the same as those used in 474.Xr iostat 8 475with one difference. Instead of specifying multiple 476.Fl t 477arguments which are then ORed together, the user instead specifys multiple 478matching expressions joined by the pipe 479.Pq Ql \&| 480character. 481The comma 482separated arguments within each matching expression are ANDed together, and 483then the pipe separated matching expressions are ORed together. Any 484device matching the combined expression will be displayed, if there is room 485to display it. For example: 486.Pp 487.Dl match da,scsi | cd,ide 488.Pp 489This will display all SCSI Direct Access devices and all IDE CDROM devices. 490.Pp 491.Dl match da | sa | cd,pass 492.Pp 493This will display all Direct Access devices, all Sequential Access devices, 494and all passthrough devices that provide access to CDROM drives. 495.El 496.Sh SEE ALSO 497.Xr netstat 1 , 498.Xr kvm 3 , 499.Xr icmp 4 , 500.Xr ip 4 , 501.Xr tcp 4 , 502.Xr udp 4 , 503.Xr iostat 8 , 504.Xr vmstat 8 505.Sh FILES 506.Bl -tag -width /boot/kernel/kernel -compact 507.It Pa /boot/kernel/kernel 508For the namelist. 509.It Pa /dev/kmem 510For information in main memory. 511.It Pa /etc/hosts 512For host names. 513.It Pa /etc/networks 514For network names. 515.It Pa /etc/services 516For port names. 517.El 518.Sh HISTORY 519The 520.Nm 521program appeared in 522.Bx 4.3 . 523The 524.Ic icmp , 525.Ic ip , 526and 527.Ic tcp 528displays appeared in 529.Fx 3.0 ; 530the notion of having different display modes for the 531.Tn ICMP , 532.Tn IP , 533.Tn TCP , 534and 535.Tn UDP 536statistics was stolen from the 537.Fl C 538option to 539.Xr netstat 1 540in Silicon Graphics' 541.Tn IRIX 542system. 543.Sh BUGS 544Certain displays presume a minimum of 80 characters per line. 545The 546.Ic vmstat 547display looks out of place because it is (it was added in as 548a separate display rather than created as a new program). 549