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