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