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