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 afHhimPsz 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 P 123Report per-cpu system/user/idle cpu statistics. 124.It Fl p 125Specify which types of devices to display. 126There are three different 127categories of devices: 128.Pp 129.Bl -tag -width indent -compact 130.It device type: 131.Bl -tag -width 9n -compact 132.It da 133Direct Access devices 134.It sa 135Sequential Access devices 136.It printer 137Printers 138.It proc 139Processor devices 140.It worm 141Write Once Read Multiple devices 142.It cd 143CD devices 144.It scanner 145Scanner devices 146.It optical 147Optical Memory devices 148.It changer 149Medium Changer devices 150.It comm 151Communication devices 152.It array 153Storage Array devices 154.It enclosure 155Enclosure Services devices 156.It floppy 157Floppy devices 158.El 159.Pp 160.It interface: 161.Bl -tag -width 9n -compact 162.It IDE 163Integrated Drive Electronics devices 164.It SCSI 165Small Computer System Interface devices 166.It other 167Any other device interface 168.El 169.Pp 170.It passthrough: 171.Bl -tag -width 9n -compact 172.It pass 173Passthrough devices 174.El 175.El 176.Pp 177The user must specify at least one device type, and may specify at most 178one device type from each category. 179Multiple device types in a single 180device type statement must be separated by commas. 181.Pp 182Any number of 183.Fl p 184arguments may be specified on the command line. 185All 186.Fl p 187arguments are ORed together to form a matching expression against which 188all devices in the system are compared. 189Any device that fully matches 190any 191.Fl p 192argument will be included in the 193.Nm 194output, up to two devices, or the maximum number of devices specified 195by the user. 196.It Fl s 197Display the contents of the 198.Em sum 199structure, giving the total number of several kinds of paging related 200events which have occurred since system startup. 201.\" .It Fl t 202.\" Report on the number of page in and page reclaims since system startup, 203.\" and the amount of time required by each. 204.It Fl w 205Pause 206.Ar wait 207seconds between each display. 208If no repeat 209.Ar wait 210interval is specified, the default is 1 second. 211The 212.Nm 213command will accept and honor a non-integer number of seconds. 214.It Fl z 215Report on memory used by the kernel zone allocator, 216.Xr uma 9 , 217by zone. 218.El 219.Pp 220The 221.Ar wait 222and 223.Ar count 224arguments may be given after their respective flags at any point 225on the command line before the 226.Ar disks 227argument(s), or without their flags, as the final argument(s). 228The latter form is accepted for backwards compatibility, but it is 229preferred to use the forms with 230.Fl w 231and 232.Fl c 233to avoid ambiguity. 234.Pp 235By default, 236.Nm 237displays the following information: 238.Bl -tag -width indent 239.It procs 240Information about the numbers of processes in various states. 241.Pp 242.Bl -tag -width indent -compact 243.It r 244in run queue 245.It b 246blocked for resources (i/o, paging, etc.) 247.It w 248runnable or short sleeper (< 20 secs) but swapped 249.El 250.It memory 251Information about the usage of virtual and real memory. 252Virtual pages (reported in units of 1024 bytes) are considered active if 253they belong to processes which are running or have run in the last 20 254seconds. 255.Pp 256.Bl -tag -width indent -compact 257.It avm 258active virtual pages 259.It fre 260size of the free list 261.El 262.It page 263Information about page faults and paging activity. 264These are averaged each five seconds, and given in units per second. 265.Pp 266.Bl -tag -width indent -compact 267.It flt 268total number of page faults 269.It re 270page reclaims (simulating reference bits) 271.\" .It at 272.\" pages attached (found in free list) 273.It pi 274pages paged in 275.It po 276pages paged out 277.It fr 278pages freed per second 279.\" .It de 280.\" anticipated short term memory shortfall 281.It sr 282pages scanned by clock algorithm, per-second 283.El 284.It disks 285Disk operations per second (this field is system dependent). 286Typically paging will be split across the available drives. 287The header of the field is the first two characters of the disk name and 288the unit number. 289If more than two disk drives are configured in the system, 290.Nm 291displays only the first two drives, unless the user specifies the 292.Fl n 293argument to increase the number of drives displayed. 294This will probably 295cause the display to exceed 80 columns, however. 296To force 297.Nm 298to display specific drives, their names may be supplied on the command line. 299The 300.Nm 301utility 302defaults to show disks first, and then various other random devices in the 303system to add up to two devices, if there are that many devices in the 304system. 305If devices are specified on the command line, or if a device type 306matching pattern is specified (see above), 307.Nm 308will only display the given devices or the devices matching the pattern, 309and will not randomly select other devices in the system. 310.It faults 311Trap/interrupt rate averages per second over last 5 seconds. 312.Pp 313.Bl -tag -width indent -compact 314.It in 315device interrupts per interval (including clock interrupts) 316.It sy 317system calls per interval 318.It cs 319cpu context switch rate (switches/interval) 320.El 321.It cpu 322Breakdown of percentage usage of CPU time. 323.Pp 324.Bl -tag -width indent -compact 325.It us 326user time for normal and low priority processes 327.It sy 328system time 329.It id 330cpu idle 331.El 332.El 333.Sh FILES 334.Bl -tag -width /boot/kernel/kernel -compact 335.It Pa /boot/kernel/kernel 336default kernel namelist 337.It Pa /dev/kmem 338default memory file 339.El 340.Sh EXAMPLES 341The command: 342.Dl vmstat -w 5 343will print what the system is doing every five 344seconds; this is a good choice of printing interval since this is how often 345some of the statistics are sampled in the system. 346Others vary every second and running the output for a while will make it 347apparent which are recomputed every second. 348.Pp 349The command: 350.Dl vmstat -p da -p cd -w 1 351will tell vmstat to select the first two direct access or CDROM devices 352and display statistics on those devices, as well as other systems 353statistics every second. 354.Sh SEE ALSO 355.Xr fstat 1 , 356.Xr netstat 1 , 357.Xr nfsstat 1 , 358.Xr ps 1 , 359.Xr systat 1 , 360.Xr libmemstat 3 , 361.Xr gstat 8 , 362.Xr iostat 8 , 363.Xr pstat 8 , 364.Xr sysctl 8 , 365.Xr malloc 9 , 366.Xr uma 9 367.Pp 368The sections starting with ``Interpreting system activity'' in 369.%T "Installing and Operating 4.3BSD" . 370.Sh BUGS 371The 372.Fl c 373and 374.Fl w 375options are only available with the default output. 376