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