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.\" 4. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 29.\" $FreeBSD$ 30.\" 31.Dd August 8, 2014 32.Dt VMSTAT 8 33.Os 34.Sh NAME 35.Nm vmstat 36.Nd report virtual memory statistics 37.Sh SYNOPSIS 38.Nm 39.\" .Op Fl fimst 40.Op Fl afHhimoPsz 41.Op Fl M Ar core Op Fl N Ar system 42.Op Fl c Ar count 43.Op Fl n Ar devs 44.Oo 45.Fl p 46.Sm off 47.Ar type , if , pass 48.Sm on 49.Oc 50.Op Fl w Ar wait 51.Op Ar disks ... 52.Op wait Op count 53.Sh DESCRIPTION 54The 55.Nm 56utility reports certain kernel statistics kept about process, virtual memory, 57disk, trap and cpu activity. 58.Pp 59If the 60.Fl M 61option is not specified, information is obtained from 62the currently running kernel via the 63.Xr sysctl 3 64interface. 65Otherwise, information is read from the specified core file, 66using the name list from the specified kernel image (or from 67the default image). 68.Pp 69The options are as follows: 70.Bl -tag -width indent 71.It Fl a 72When used with 73.Fl i , 74include statistics about interrupts that have never been generated. 75.It Fl c 76Repeat the display 77.Ar count 78times. 79The first display is for the time since a reboot and each subsequent 80report is for the time period since the last display. 81If no repeat 82.Ar count 83is specified, and 84.Fl w 85is specified, the default is infinity, otherwise the default is one. 86.It Fl f 87Report on the number 88.Xr fork 2 , 89.Xr vfork 2 90and 91.Xr rfork 2 92system calls since system startup, and the number of pages of virtual memory 93involved in each. 94.It Fl h 95Changes memory columns into more easily human readable form. 96The default if 97standard output is a terminal device. 98.It Fl H 99Changes memory columns into straight numbers. 100The default if standard output 101is not a terminal device (such as a script). 102.It Fl i 103Report on the number of interrupts taken by each device since system 104startup. 105.It Fl M 106Extract values associated with the name list from the specified 107.Ar core . 108.It Fl N 109If 110.Fl M 111is also specified, 112extract the name list from the specified 113.Ar system 114instead of the default, 115which is the kernel image the system has booted from. 116.It Fl m 117Report on the usage of kernel dynamic memory allocated using 118.Xr malloc 9 119by type. 120.It Fl n 121Change the maximum number of disks to display from the default of 2. 122.It Fl o 123Display a list of virtual memory objects in the system and the resident 124memory used by each object. 125.It Fl P 126Report per-cpu system/user/idle cpu statistics. 127.It Fl p 128Specify which types of devices to display. 129There are three different 130categories of devices: 131.Pp 132.Bl -tag -width indent -compact 133.It device type: 134.Bl -tag -width 9n -compact 135.It da 136Direct Access devices 137.It sa 138Sequential Access devices 139.It printer 140Printers 141.It proc 142Processor devices 143.It worm 144Write Once Read Multiple devices 145.It cd 146CD devices 147.It scanner 148Scanner devices 149.It optical 150Optical Memory devices 151.It changer 152Medium Changer devices 153.It comm 154Communication devices 155.It array 156Storage Array devices 157.It enclosure 158Enclosure Services devices 159.It floppy 160Floppy devices 161.El 162.Pp 163.It interface: 164.Bl -tag -width 9n -compact 165.It IDE 166Integrated Drive Electronics devices 167.It SCSI 168Small Computer System Interface devices 169.It other 170Any other device interface 171.El 172.Pp 173.It passthrough: 174.Bl -tag -width 9n -compact 175.It pass 176Passthrough devices 177.El 178.El 179.Pp 180The user must specify at least one device type, and may specify at most 181one device type from each category. 182Multiple device types in a single 183device type statement must be separated by commas. 184.Pp 185Any number of 186.Fl p 187arguments may be specified on the command line. 188All 189.Fl p 190arguments are ORed together to form a matching expression against which 191all devices in the system are compared. 192Any device that fully matches 193any 194.Fl p 195argument will be included in the 196.Nm 197output, up to two devices, or the maximum number of devices specified 198by the user. 199.It Fl s 200Display the contents of the 201.Em sum 202structure, giving the total number of several kinds of paging related 203events which have occurred since system startup. 204.\" .It Fl t 205.\" Report on the number of page in and page reclaims since system startup, 206.\" and the amount of time required by each. 207.It Fl w 208Pause 209.Ar wait 210seconds between each display. 211If no repeat 212.Ar wait 213interval is specified, the default is 1 second. 214The 215.Nm 216command will accept and honor a non-integer number of seconds. 217.It Fl z 218Report on memory used by the kernel zone allocator, 219.Xr uma 9 , 220by zone. 221.El 222.Pp 223The 224.Ar wait 225and 226.Ar count 227arguments may be given after their respective flags at any point 228on the command line before the 229.Ar disks 230argument(s), or without their flags, as the final argument(s). 231The latter form is accepted for backwards compatibility, but it is 232preferred to use the forms with 233.Fl w 234and 235.Fl c 236to avoid ambiguity. 237.Pp 238By default, 239.Nm 240displays the following information: 241.Bl -tag -width indent 242.It procs 243Information about the numbers of processes in various states. 244.Pp 245.Bl -tag -width indent -compact 246.It r 247in run queue 248.It b 249blocked for resources (i/o, paging, etc.) 250.It w 251runnable or short sleeper (< 20 secs) but swapped 252.El 253.It memory 254Information about the usage of virtual and real memory. 255Virtual pages (reported in units of 1024 bytes) are considered active if 256they belong to processes which are running or have run in the last 20 257seconds. 258.Pp 259.Bl -tag -width indent -compact 260.It avm 261active virtual pages 262.It fre 263size of the free list 264.El 265.It page 266Information about page faults and paging activity. 267These are averaged each five seconds, and given in units per second. 268.Pp 269.Bl -tag -width indent -compact 270.It flt 271total number of page faults 272.It re 273page reclaims (simulating reference bits) 274.\" .It at 275.\" pages attached (found in free list) 276.It pi 277pages paged in 278.It po 279pages paged out 280.It fr 281pages freed per second 282.\" .It de 283.\" anticipated short term memory shortfall 284.It sr 285pages scanned by clock algorithm, per-second 286.El 287.It disks 288Disk operations per second (this field is system dependent). 289Typically paging will be split across the available drives. 290The header of the field is the first two characters of the disk name and 291the unit number. 292If more than two disk drives are configured in the system, 293.Nm 294displays only the first two drives, unless the user specifies the 295.Fl n 296argument to increase the number of drives displayed. 297This will probably 298cause the display to exceed 80 columns, however. 299To force 300.Nm 301to display specific drives, their names may be supplied on the command line. 302The 303.Nm 304utility 305defaults to show disks first, and then various other random devices in the 306system to add up to two devices, if there are that many devices in the 307system. 308If devices are specified on the command line, or if a device type 309matching pattern is specified (see above), 310.Nm 311will only display the given devices or the devices matching the pattern, 312and will not randomly select other devices in the system. 313.It faults 314Trap/interrupt rate averages per second over last 5 seconds. 315.Pp 316.Bl -tag -width indent -compact 317.It in 318device interrupts per interval (including clock interrupts) 319.It sy 320system calls per interval 321.It cs 322cpu context switch rate (switches/interval) 323.El 324.It cpu 325Breakdown of percentage usage of CPU time. 326.Pp 327.Bl -tag -width indent -compact 328.It us 329user time for normal and low priority processes 330.It sy 331system time 332.It id 333cpu idle 334.El 335.El 336.Sh FILES 337.Bl -tag -width /boot/kernel/kernel -compact 338.It Pa /boot/kernel/kernel 339default kernel namelist 340.It Pa /dev/kmem 341default memory file 342.El 343.Sh EXAMPLES 344The command: 345.Dl vmstat -w 5 346will print what the system is doing every five 347seconds; this is a good choice of printing interval since this is how often 348some of the statistics are sampled in the system. 349Others vary every second and running the output for a while will make it 350apparent which are recomputed every second. 351.Pp 352The command: 353.Dl vmstat -p da -p cd -w 1 354will tell vmstat to select the first two direct access or CDROM devices 355and display statistics on those devices, as well as other systems 356statistics every second. 357.Sh SEE ALSO 358.Xr fstat 1 , 359.Xr netstat 1 , 360.Xr nfsstat 1 , 361.Xr ps 1 , 362.Xr systat 1 , 363.Xr libmemstat 3 , 364.Xr gstat 8 , 365.Xr iostat 8 , 366.Xr pstat 8 , 367.Xr sysctl 8 , 368.Xr malloc 9 , 369.Xr uma 9 370.Pp 371The sections starting with ``Interpreting system activity'' in 372.%T "Installing and Operating 4.3BSD" . 373.Sh BUGS 374The 375.Fl c 376and 377.Fl w 378options are only available with the default output. 379