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