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