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