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