1.\" Copyright (c) 1986, 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.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 33.\" $FreeBSD$ 34.\" 35.Dd April 14, 2003 36.Dt VMSTAT 8 37.Os 38.Sh NAME 39.Nm vmstat 40.Nd report virtual memory statistics 41.Sh SYNOPSIS 42.Nm 43.\" .Op Fl fimst 44.Op Fl fimsz 45.Op Fl c Ar count 46.Op Fl M Ar core 47.Op Fl N Ar system 48.Op Fl w Ar wait 49.Op Fl n Ar devs 50.Oo 51.Fl p 52.Sm off 53.Ar type , if , pass 54.Sm on 55.Oc 56.Op Ar disks 57.Sh DESCRIPTION 58The 59.Nm 60utility reports certain kernel statistics kept about process, virtual memory, 61disk, trap and cpu activity. 62.Pp 63The options are as follows: 64.Bl -tag -width indent 65.It Fl c 66Repeat the display 67.Ar count 68times. 69The first display is for the time since a reboot and each subsequent 70report is for the time period since the last display. 71If no repeat 72.Ar count 73is specified, and 74.Fl w 75is specified, the default is infinity, otherwise the default is one. 76.It Fl f 77Report on the number 78.Xr fork 2 , 79.Xr vfork 2 80and 81.Xr rfork 2 82system calls since system startup, and the number of pages of virtual memory 83involved in each. 84.It Fl i 85Report on the number of interrupts taken by each device since system 86startup. 87.It Fl M 88Extract values associated with the name list from the specified 89.Ar core 90instead of the default 91.Pa /dev/kmem . 92.It Fl N 93Extract the name list from the specified 94.Ar system 95instead of the default 96.Pa /boot/kernel/kernel . 97.It Fl m 98Report on the usage of kernel dynamic memory listed first by size of 99allocation and then by type of usage. 100.It Fl n 101Change the maximum number of disks to display from the default of 2. 102.It Fl p 103Specify which types of devices to display. There are three different 104categories of devices: 105.Pp 106.Bl -tag -width indent -compact 107.It device type: 108.Bl -tag -width 9n -compact 109.It da 110Direct Access devices 111.It sa 112Sequential Access devices 113.It printer 114Printers 115.It proc 116Processor devices 117.It worm 118Write Once Read Multiple devices 119.It cd 120CD devices 121.It scanner 122Scanner devices 123.It optical 124Optical Memory devices 125.It changer 126Medium Changer devices 127.It comm 128Communication devices 129.It array 130Storage Array devices 131.It enclosure 132Enclosure Services devices 133.It floppy 134Floppy devices 135.El 136.Pp 137.It interface: 138.Bl -tag -width 9n -compact 139.It IDE 140Integrated Drive Electronics devices 141.It SCSI 142Small Computer System Interface devices 143.It other 144Any other device interface 145.El 146.Pp 147.It passthrough: 148.Bl -tag -width 9n -compact 149.It pass 150Passthrough devices 151.El 152.El 153.Pp 154The user must specify at least one device type, and may specify at most 155one device type from each category. Multiple device types in a single 156device type statement must be separated by commas. 157.Pp 158Any number of 159.Fl p 160arguments may be specified on the command line. All 161.Fl p 162arguments are ORed together to form a matching expression against which 163all devices in the system are compared. Any device that fully matches 164any 165.Fl p 166argument will be included in the 167.Nm 168output, up to three devices, or the maximum number of devices specified 169by the user. 170.It Fl s 171Display the contents of the 172.Em sum 173structure, giving the total number of several kinds of paging related 174events which have occurred since system startup. 175.\" .It Fl t 176.\" Report on the number of page in and page reclaims since system startup, 177.\" and the amount of time required by each. 178.It Fl w 179Pause 180.Ar wait 181seconds between each display. 182If no repeat 183.Ar wait 184interval is specified, the default is 1 second. 185.It Fl z 186Report on memory used by the kernel zone allocator, by zone. 187The information shown is the same as that returned by the 188.Va vm.zone 189sysctl variable. 190.El 191.Pp 192By default, 193.Nm 194displays the following information: 195.Pp 196.Bl -tag -width indent 197.It procs 198Information about the numbers of processes in various states. 199.Pp 200.Bl -tag -width indent -compact 201.It r 202in run queue 203.It b 204blocked for resources (i/o, paging, etc.) 205.It w 206runnable or short sleeper (< 20 secs) but swapped 207.El 208.It memory 209Information about the usage of virtual and real memory. 210Virtual pages (reported in units of 1024 bytes) are considered active if 211they belong to processes which are running or have run in the last 20 212seconds. 213.Pp 214.Bl -tag -width indent -compact 215.It avm 216active virtual pages 217.It fre 218size of the free list 219.El 220.It page 221Information about page faults and paging activity. 222These are averaged each five seconds, and given in units per second. 223.Pp 224.Bl -tag -width indent -compact 225.It flt 226total number of page faults 227.It re 228page reclaims (simulating reference bits) 229.\" .It at 230.\" pages attached (found in free list) 231.It pi 232pages paged in 233.It po 234pages paged out 235.It fr 236pages freed per second 237.\" .It de 238.\" anticipated short term memory shortfall 239.It sr 240pages scanned by clock algorithm, per-second 241.El 242.It disks 243Disk operations per second (this field is system dependent). 244Typically paging will be split across the available drives. 245The header of the field is the first two characters of the disk name and 246the unit number. 247If more than three disk drives are configured in the system, 248.Nm 249displays only the first three drives, unless the user specifies the 250.Fl n 251argument to increase the number of drives displayed. This will probably 252cause the display to exceed 80 columns, however. 253To force 254.Nm 255to display specific drives, their names may be supplied on the command line. 256The 257.Nm 258utility 259defaults to show disks first, and then various other random devices in the 260system to add up to three devices, if there are that many devices in the 261system. If devices are specified on the command line, or if a device type 262matching pattern is specified (see above), 263.Nm 264will only display the given devices or the devices matching the pattern, 265and will not randomly select other devices in the system. 266.It faults 267Trap/interrupt rate averages per second over last 5 seconds. 268.Pp 269.Bl -tag -width indent -compact 270.It in 271device interrupts per interval (including clock interrupts) 272.It sy 273system calls per interval 274.It cs 275cpu context switch rate (switches/interval) 276.El 277.It cpu 278Breakdown of percentage usage of CPU time. 279.Pp 280.Bl -tag -width indent -compact 281.It us 282user time for normal and low priority processes 283.It sy 284system time 285.It id 286cpu idle 287.El 288.El 289.Sh EXAMPLES 290The command: 291.Dl vmstat -w 5 292will print what the system is doing every five 293seconds; this is a good choice of printing interval since this is how often 294some of the statistics are sampled in the system. 295Others vary every second and running the output for a while will make it 296apparent which are recomputed every second. 297.Pp 298The command: 299.Dl vmstat -p da -p cd -w 1 300will tell vmstat to select the first three direct access or CDROM devices 301and display statistics on those devices, as well as other systems 302statistics every second. 303.Sh FILES 304.Bl -tag -width /boot/kernel/kernel -compact 305.It Pa /boot/kernel/kernel 306default kernel namelist 307.It Pa /dev/kmem 308default memory file 309.El 310.Sh SEE ALSO 311.Xr fstat 1 , 312.Xr netstat 1 , 313.Xr nfsstat 1 , 314.Xr ps 1 , 315.Xr systat 1 , 316.Xr iostat 8 , 317.Xr pstat 8 , 318.Xr sysctl 8 319.Pp 320The sections starting with ``Interpreting system activity'' in 321.%T "Installing and Operating 4.3BSD" . 322.Sh BUGS 323The 324.Fl c 325and 326.Fl w 327options are only available with the default output. 328