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