1.\" $NetBSD: systat.1,v 1.54 2023/03/29 21:44:35 uwe 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. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)systat.1 8.2 (Berkeley) 12/30/93 31.\" 32.Dd March 29, 2023 33.Dt SYSTAT 1 34.Os 35.Sh NAME 36.Nm systat 37.Nd display system statistics in a full-screen view 38.Sh SYNOPSIS 39.Nm 40.Op Fl bnz 41.Op Fl M Ar core 42.Op Fl N Ar system 43.Op Fl t Ar turns 44.Op Fl w Ar wait 45.Op Ar display 46.Op Ar wait 47.Sh DESCRIPTION 48.Nm 49displays various system statistics in a screen oriented fashion 50using the 51.Xr curses 3 52screen display library. 53.Pp 54While 55.Nm 56is running the screen is usually divided into two windows 57.Pq an exception is the vmstat display which uses the entire screen . 58The upper window depicts the current system load average. 59The information displayed in the lower window may vary, depending on 60user commands. 61The last line on the screen is reserved for user input and error messages. 62.Pp 63By default 64.Nm 65displays the processes getting the largest percentage of the processor 66in the lower window. 67Other displays show more detailed process information, 68swap space usage, 69disk usage statistics 70.Pq a\~la Xr df 1 , 71disk I/O statistics 72.Pq a\~la Xr iostat 8 , 73virtual memory statistics 74.Pq a\~la Xr vmstat 1 , 75network mbuf utilization, 76network interface traffic, 77and network connections 78.Pq a\~la Xr netstat 1 . 79.Pp 80Input is interpreted at two different levels. 81A global command interpreter processes all keyboard input. 82If this command interpreter fails to recognize a command, the 83input line is passed to a per-display command interpreter. 84This allows each display to have certain display-specific commands. 85.Pp 86Command line options: 87.Bl -tag -width Fl 88.It Fl b 89Show the chosen display once and exit. 90.It Fl M Ar core 91Extract values associated with the name list from 92.Ar core 93instead of the default 94.Pa /dev/mem . 95.It Fl N Ar system 96Extract the name list from 97.Ar system 98instead of the default 99.Pa /netbsd . 100.It Fl n 101Do not resolve IP addresses into string hostnames 102.Pf ( Tn FQDN Ns s ) . 103It has the same effect as 104.Ic numbers 105subcommand in 106.Ic netstat . 107.It Fl t Ar turns 108How many refresh cycles to show each screen in 109.Sq all 110display mode. 111The default is 2. 112.It Fl w Ar wait 113Set the screen refresh interval to 114.Ar wait 115seconds. 116Floating point numbers are accepted. 117The default is 1\~second. 118.It Fl z 119Display 0 instead of space when there is no data. 120.It Ar display 121The 122.Ar display 123argument expects to be one of: 124.Ic all , 125.Ic bufcache , 126.Ic df , 127.Ic ifstat , 128.Ic inet.icmp , 129.Ic inet.ip , 130.Ic inet.tcp , 131.Ic inet.tcpsyn , 132.Ic inet6.ip6 , 133.Ic iostat , 134.Ic mbufs , 135.Ic netstat , 136.Ic pigs , 137.Ic ps , 138.Ic swap , 139.Ic syscall 140or 141.Ic vmstat . 142These displays can also be requested interactively and are described in 143full detail below. 144.It Ar wait 145The same as 146.Fl w Ar wait . 147This form is provided for backwards compatibility. 148.El 149.Pp 150Certain characters cause immediate action by 151.Nm . 152These are 153.Bl -tag -width Ic 154.It Ic \&^L 155Refresh the screen. 156.It Ic \&^G 157Print the name of the current display being shown in 158the lower window and the refresh interval. 159.It Ic \&^Z 160Suspend 161.Nm . 162.It Ic \&? , Ic h 163Print the names of the available displays on the command line. 164.It Ic \&: 165Move the cursor to the command line and interpret the input 166line typed as a command. 167While entering a command the current character erase, word erase, 168and line kill characters may be used. 169.El 170.Pp 171The following commands are interpreted by the global 172command interpreter. 173.Bl -tag -width Ic 174.It Ic help Op Ar key 175Print the names of the available displays on the command line. 176It will print long names as 177.Ql inet.* . 178To print items under 179.Ic inet , 180give 181.Ic inet 182as 183.Ar key . 184.It Ic load 185Print the load average over the past 1, 5, and 15 minutes 186on the command line. 187.It Ic quit 188Exit 189.Nm . 190.Pq This may be abbreviated to Ic q . 191.It Oo Ic start Oc Oo Ar number Oc 192Start (continue) refreshing the screen. 193If a second, numeric, argument is provided it is interpreted as a 194refresh interval in seconds. 195Supplying only a number will set the refresh interval to this 196value. 197.It Ic stop 198Stop refreshing the screen. 199.El 200.Pp 201The available displays are: 202.Bl -tag -width Ic 203.It Ic all 204Cycle through all displays automatically. 205At each display, wait some 206refresh-turns, then switch to the next display. 207Duration of one refresh-turn is adjustable with the 208.Fl w 209option, number of refresh-turns can be changed with the 210.Fl t 211option. 212.It Ic bufcache 213Display, in the lower window, statistics about the file system buffers. 214Statistics for each file system that has active buffers include the number 215of buffers for that file system, the number of active kilobytes in those 216buffers and the total size of the buffers for that file system. 217.It Ic df 218Lists disk usage statistics for all filesystems, 219including the available free space as well as a bar 220graph indicating the used capacity. 221.Pp 222The following commands are specific to the 223.Ic df 224display: 225.Pp 226.Bl -tag -width Fl 227.It Cm all 228Displays information for all filesystems, including 229kernfs, procfs and null-mounts. 230.It Cm some 231Suppress information about procfs, kernfs and null-mounts (default). 232.El 233.It Ic ifstat 234Display the network traffic going through active interfaces on the 235system. 236Idle interfaces will not be displayed until they receive some 237traffic. 238.Pp 239For each interface being displayed, the current, peak and total 240statistics are displayed for incoming and outgoing traffic. 241By default, 242the 243.Ic ifstat 244display will automatically scale the units being used so that they are 245in a human-readable format. 246The scaling units used for the current and 247peak 248traffic columns can be altered by the 249.Ic scale 250command. 251.Bl -tag -width Cm 252.It Cm scale Op Ar units 253Modify the scale used to display the current and peak traffic over all 254interfaces. 255The following units are recognised: 256.Ic kbit , kbyte , mbit , mbyte , gbit , gbyte 257and 258.Ic auto . 259.It Cm pps 260Show statistics in packets per second instead of bytes or bits per second. 261A subsequent call of 262.Ic pps 263switches this mode off. 264.It Cm match Op Ar pattern ... 265Display only interfaces that match 266.Ar pattern\^ Ns s 267provided as an argument. 268Patterns should be in shell 269.Xr glob 7 270syntax separated by whitespaces or commas. 271If this command is called without arguments then all interfaces are displayed. 272For example: 273.Pp 274.Dl match re0, bge1 275.Pp 276This will display 277.Li re0 278and 279.Li bge1 280interfaces. 281.Pp 282.Dl match re* bge* lo0 283.Pp 284This will display all 285.Li re 286interfaces, all 287.Li bge 288interfaces and the loopback interface. 289.El 290.It Ic inet.icmp 291Display ICMP statistics. 292.It Ic inet.ip 293Display IPv4 and UDP statistics. 294.It Ic inet.tcp 295Display TCP statistics. 296.It Ic inet.tcpsyn 297Display statistics about the TCP syncache. 298.It Ic inet6.ip6 299Display IPv6 statistics. 300.It Ic iostat 301Display, in the lower window, statistics about processor use 302and disk throughput. 303Statistics on processor use appear as bar graphs of the amount of 304time executing in user mode, 305in user mode running low priority 306.Pq Dq nice 307processes, 308in system mode, 309and idle. 310Statistics on disk throughput show, for each drive, kilobytes of 311data transferred, number of disk transactions performed, and time 312spent in disk accesses in milliseconds. 313This information may be displayed as bar graphs or as rows of 314numbers which scroll downward. 315Bar graphs are shown by default; 316.Pp 317The following commands are specific to the 318.Ic iostat 319display; the minimum unambiguous prefix may be supplied. 320.Pp 321.Bl -tag -width Fl -compact 322.It Cm numbers 323Show the disk I/O statistics in numeric form. 324Values are 325displayed in numeric columns which scroll downward. 326.It Cm bars 327Show the disk I/O statistics in bar graph form (default). 328.It Cm secs 329Toggle the display of time in disk activity (the default is to 330not display time). 331.It Cm all 332Show the read and write statistics combined (default). 333.It Cm rw 334Show the read and write statistics separately. 335.El 336.It Ic mbufs 337Display, in the lower window, the number of mbufs allocated 338for particular uses, i.e. data, socket structures, etc. 339.It Ic netstat 340Display, in the lower window, network connections. 341By default, network servers awaiting requests are not displayed. 342Each address is displayed in the format 343.Ar host Ns Li . Ns Ar port , 344with each 345shown symbolically, when possible. 346It is possible to have addresses displayed numerically, 347limit the display to a set of ports, hosts, and/or protocols 348.Pq the minimum unambiguous prefix may be supplied : 349.Pp 350.Bl -tag -width Cm 351.It Cm all 352Toggle the displaying of server processes awaiting requests 353.Po 354this is the equivalent of the 355.Fl a 356flag to 357.Xr netstat 1 358.Pc . 359.It Cm display Op Ar items 360Display information about the connections associated with the 361specified hosts or ports. 362Hosts and ports may be specified by name 363.Pq Ql vangogh , ftp , 364or numerically. 365Host addresses use the Internet dot notation 366.Pq Ql 128.32.0.9 . 367Multiple items may be specified with a single command by separating 368them with spaces. 369.It Cm ignore Op Ar items 370Do not display information about connections associated with 371the specified hosts or ports. 372As for 373.Ic display , 374the 375.Ar items 376may be names or numbers. 377.It Cm names 378Display network addresses symbolically. 379.It Cm numbers 380Display network addresses numerically. 381.It Ar protocol 382Display only network connections using the indicated protocol 383.Po 384currently either 385.Ic tcp 386or 387.Ic udp 388.Pc . 389.It Cm show Op Cm hosts No \&| Cm ports 390Show, on the command line, the currently selected protocols, 391hosts, and ports. 392Hosts and ports which are being ignored are prefixed with a 393.Ql \&! . 394If 395.Cm ports 396or 397.Cm hosts 398is supplied as an argument to 399.Cm show , 400then only the requested information will be displayed. 401.It Cm reset 402Reset the port, host, and protocol filters, show everything. 403.El 404.It Ic pigs 405Display, in the lower window, those processes which are getting the 406largest portion of the processor (the default display). 407When less than 100% of the 408processor is scheduled to user processes, the remaining time 409is accounted to the idle process. 410.It Ic ps 411Display, in the lower window, the same information provided 412by the command 413.Xr ps 1 414with the flags 415.Fl aux . 416.Pp 417The following command is specific to the 418.Ic ps 419display; the minimum unambiguous prefix may be supplied. 420.Pp 421.Bl -tag -width Fl -compact 422.It Cm user Ar name 423Limit the list of processes displayed to those owned by user 424.Ar name . 425If 426.Ar name 427is specified as 428.Ql \&+ , 429processes owned by any user are displayed (default). 430.El 431.It Ic swap 432Show information about swap space usage on all the 433swap areas configured with 434.Xr swapctl 8 . 435The first column is the device name of the partition. 436The next column is the total space available in the partition. 437The 438.Dq Used 439column indicates the total blocks used so far; 440the graph shows the percentage of space in use on each partition. 441If there are more than one swap partition in use, 442a total line is also shown. 443Areas known to the kernel, but not in use are shown as not available. 444.It Ic syscall 445Show per system call statistics. 446The display consists of several columns of system call name and counts. 447.Pp 448In order to stop entries moving around the screen too much, an infinite 449response filter is applied to the values before they are sorted. 450.Pp 451The following commands are specific to the 452.Ic syscall 453display: 454.Pp 455.Bl -tag -width Ar -compact 456.It Ic sort Ic name 457Sort display by the syscall name (default). 458.It Ic sort Ic count 459Sort display by the count of calls or time spent in the calls. 460.It Ic sort Ic syscall 461Sort display be syscall number. 462.It Ic show Ic count 463Show the number of times the system call has be called (default). 464.It Ic show Ic time 465Show the average amount of time (in arbitrary units) spent in a call of 466the syscall. 467.El 468.It Ic vmstat 469Take over the entire display and show a (rather crowded) compendium 470of statistics related to virtual memory usage, process scheduling, 471device interrupts, system name translation caching, disk I/O etc. 472.Pp 473The upper left quadrant of the screen shows the number 474of users logged in and the load average over the last one, five, 475and fifteen minute intervals. 476Below this are statistics on memory utilization. 477The first row of the table reports memory usage only among 478active processes, that is processes that have run in the previous 479twenty seconds. 480The second row reports on memory usage of all processes. 481The first column reports on the number of physical pages 482claimed by processes. 483The second column reports the number of physical pages that 484are devoted to read only text pages. 485The third and fourth columns report the same two figures for 486virtual pages, that is the number of pages that would be 487needed if all processes had all of their pages. 488Finally the last column shows the number of physical pages 489on the free list. 490.Pp 491Below the memory display is a list of the 492average number of processes (over the last refresh interval) 493that are runnable (`r'), in page wait (`p'), 494in disk wait other than paging (`d'), sleeping (`s'). 495Below the queue length listing is a numerical listing and 496a bar graph showing the amount of 497system (shown as `='), user (shown as `>'), 498nice (shown as `-'), and idle time (shown as ` '). 499.Pp 500To the right of the process statistics is a column that 501lists the average number of context switches (`Csw'), 502traps (`Traps'; includes page faults), system calls (`SysCa'), interrupts (`Intr'), 503network software interrupts (`Soft'), 504page faults (`Fault'). 505.Pp 506Below this are statistics on memory utilization. 507The first row of the table reports memory usage only among 508active processes, that is processes that have run in the previous 509twenty seconds. 510The second row reports on memory usage of all processes. 511The first column reports on the number of physical pages 512claimed by processes. 513The second column reports the number of pages of memory and swap. 514The third column gives the number of pages of free memory and swap. 515.Pp 516Below the memory display are statistics on name translations. 517It lists the number of names translated in the previous interval, 518the number and percentage of the translations that were 519handled by the system wide name translation cache, and 520the number and percentage of the translations that were 521handled by the per process name translation cache. 522.Pp 523At the bottom left is the disk usage display. 524It reports the number of seeks, transfers, number 525of kilobyte blocks transferred per second averaged over the 526refresh period of the display (by default, five seconds), and 527the time spent in disk accesses. 528If there are more than five disks, and the terminal window has more 529than 24 lines, the disks display will be flipped so that more 530of the disk statistics are visible. 531.Pp 532Under the date in the upper right hand quadrant are statistics 533on paging and swapping activity. 534The first two columns report the average number of pages 535brought in and out per second over the last refresh interval 536due to page faults and the paging daemon. 537The third and fourth columns report the average number of pages 538brought in and out per second over the last refresh interval 539due to swap requests initiated by the scheduler. 540The first row of the display shows the average 541number of disk transfers per second over the last refresh interval; 542the second row of the display shows the average 543number of pages transferred per second over the last refresh interval. 544.Pp 545Below the paging statistics is another columns of paging data. 546From top to bottom, these represent: 547.Pp 548.Bl -tag -width Fl -compact 549.It Sq Ic forks 550number of 551.Fn fork 552calls 553.It Sq Ic fkppw 554number of 555.Fn fork 556calls where parent waits 557.It Sq Ic fksvm 558number of 559.Fn fork 560calls where vmspace is shared 561.It Sq Ic pwait 562number of times fault had to wait on a page 563.It Sq Ic relck 564number of times 565.Fn uvmfault_relock 566is called 567.It Sq Ic rlkok 568number of times 569.Fn uvmfault_relock 570is a success 571.It Sq Ic noram 572number of times fault was out of RAM 573.It Sq Ic ndcpy 574number of times fault clears ``needs copy'' 575.It Sq Ic fltcp 576number of times fault promotes with copy (2b) 577.It Sq Ic zfod 578number of times fault promotes with zerofill (2b) 579.It Sq Ic cow 580number of times faulted for anonymous for Copy-On-Write (case 1b) 581.It Sq Ic fmin 582min number of free pages 583.It Sq Ic ftarg 584target number of free pages 585.It Sq Ic itarg 586target number of inactive pages 587.It Sq Ic flnan 588number of times fault was out of anonymous pages 589.It Sq Ic pdfre 590number of pages daemon freed since boot 591.It Sq Ic pdscn 592number of pages daemon scanned since boot 593.El 594.Pp 595Note that the `%zfod' percentage is usually less than 100%, 596however it may exceed 100% if a large number of requests 597are actually used long after they were set up during a 598period when no new pages are being set up. 599Thus this figure is most interesting when observed over 600a long time period, such as from boot time 601(see below on getting such a display). 602.Pp 603To the left of the column of paging statistics is a breakdown 604of the interrupts being handled by the system. 605At the top of the list is the total interrupts per second 606over the time interval. 607The rest of the column breaks down the total on a device 608by device basis. 609Only devices that have interrupted at least once since boot time are shown. 610.El 611.Pp 612Commands to switch between displays may be abbreviated to the 613minimum unambiguous prefix; for example, 614.Ic io 615for 616.Ic iostat . 617Certain information may be discarded when the screen size is 618insufficient for display. 619For example, on a machine with 10 drives the 620.Ic iostat 621bar graph displays only 3 drives on a 24 line terminal. 622When a bar graph would overflow the allotted screen space it is 623truncated and the actual value is printed ``over top'' of the bar. 624.Pp 625The following commands are common to each display which shows 626information about disk drives. 627These commands are used to select a set of drives to report on, 628should your system have more drives configured than can normally 629be displayed on the screen. 630Drives may be specified as drive names or as patterns specified in the 631notation described by 632.Xr fnmatch 3 . 633.Pp 634.Bl -tag -width Ar -compact 635.It Cm display Op Ar drives 636Display information about the drives indicated. 637Multiple drives may be specified, separated by spaces. 638.It Cm ignore Op Ar drives 639Do not display information about the drives indicated. 640Multiple drives may be specified, separated by spaces. 641.It Cm drives Op Ar drives 642With no arguments, display a list of available drives. 643With arguments, replace the list of currently displayed drives 644with the ones specified. 645.El 646.Pp 647The following commands are specific to the 648.Ic inet.* , 649.Ic inet6.* , 650.Ic syscall 651and 652.Ic vmstat 653displays; the minimum unambiguous prefix may be supplied. 654.Pp 655.Bl -tag -width Ar -compact 656.It Cm boot 657Display cumulative statistics since the system was booted. 658.It Cm run 659Display statistics as a running total from the point this 660command is given. 661.It Cm time 662Display statistics averaged over the refresh interval (the default). 663.It Cm zero 664Reset running statistics to zero. 665.El 666.Sh FILES 667.Bl -tag -width /etc/networks -compact 668.It Pa /netbsd 669For the namelist. 670.It Pa /dev/kmem 671For information in main memory. 672.It Pa /etc/hosts 673For host names. 674.It Pa /etc/networks 675For network names. 676.It Pa /etc/services 677For port names. 678.El 679.Sh NOTES 680Most of the information shown by 681.Nm 682.Ic vmstat 683is obtained from the 684.Ql vm.vmmeter 685.Xr sysctl 7 686node. 687.Sh SEE ALSO 688.Xr df 1 , 689.Xr netstat 1 , 690.Xr ps 1 , 691.Xr top 1 , 692.Xr vmstat 1 , 693.Xr iostat 8 , 694.Xr pstat 8 695.Sh HISTORY 696The 697.Nm 698program appeared in 699.Bx 4.3 . 700.Sh BUGS 701Consumes CPU resources and thus may skew statistics. 702.Pp 703Certain displays presume a minimum of 80 characters per line. 704.Pp 705The 706.Ic vmstat 707display looks out of place because it is (it was added in as 708a separate display from what used to be a different program). 709.Pp 710The 711.Fl b 712option requires a real terminal and could be converted to 713simply output to standard output. 714