19b50d902SRodney W. Grimes.\" Copyright (c) 1986, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 129b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 139b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 149b50d902SRodney W. Grimes.\" without specific prior written permission. 159b50d902SRodney W. Grimes.\" 169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b50d902SRodney W. Grimes.\" SUCH DAMAGE. 279b50d902SRodney W. Grimes.\" 289b50d902SRodney W. Grimes.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 29c3aac50fSPeter Wemm.\" $FreeBSD$ 309b50d902SRodney W. Grimes.\" 31*e1ba604aSBenjamin Kaduk.Dd August 8, 2014 321c1f145fSMike Pritchard.Dt VMSTAT 8 3362500372SRuslan Ermilov.Os 341c1f145fSMike Pritchard.Sh NAME 351c1f145fSMike Pritchard.Nm vmstat 361c1f145fSMike Pritchard.Nd report virtual memory statistics 371c1f145fSMike Pritchard.Sh SYNOPSIS 388fe908efSRuslan Ermilov.Nm 39aeaa52dbSSteve Price.\" .Op Fl fimst 404adb5266SPeter Wemm.Op Fl afHhimPsz 41ab82970eSRuslan Ermilov.Op Fl M Ar core Op Fl N Ar system 42*e1ba604aSBenjamin Kaduk.Op Fl c Ar count 438d2fbde5SJustin T. Gibbs.Op Fl n Ar devs 44d0353b83SRuslan Ermilov.Oo 45d0353b83SRuslan Ermilov.Fl p 46d0353b83SRuslan Ermilov.Sm off 47d0353b83SRuslan Ermilov.Ar type , if , pass 48d0353b83SRuslan Ermilov.Sm on 49d0353b83SRuslan Ermilov.Oc 50*e1ba604aSBenjamin Kaduk.Op Fl w Ar wait 51*e1ba604aSBenjamin Kaduk.Op Ar disks ... 52*e1ba604aSBenjamin Kaduk.Op wait Op count 531c1f145fSMike Pritchard.Sh DESCRIPTION 54084e1980SPhilippe CharnierThe 55084e1980SPhilippe Charnier.Nm 56084e1980SPhilippe Charnierutility reports certain kernel statistics kept about process, virtual memory, 579b50d902SRodney W. Grimesdisk, trap and cpu activity. 581c1f145fSMike Pritchard.Pp 59ab82970eSRuslan ErmilovIf the 60ab82970eSRuslan Ermilov.Fl M 61ab82970eSRuslan Ermilovoption is not specified, information is obtained from 62ab82970eSRuslan Ermilovthe currently running kernel via the 63ab82970eSRuslan Ermilov.Xr sysctl 3 64ab82970eSRuslan Ermilovinterface. 65ab82970eSRuslan ErmilovOtherwise, information is read from the specified core file, 66ab82970eSRuslan Ermilovusing the name list from the specified kernel image (or from 67ab82970eSRuslan Ermilovthe default image). 68ab82970eSRuslan Ermilov.Pp 699b50d902SRodney W. GrimesThe options are as follows: 701c1f145fSMike Pritchard.Bl -tag -width indent 71c5163382SDag-Erling Smørgrav.It Fl a 72c5163382SDag-Erling SmørgravWhen used with 73c5163382SDag-Erling Smørgrav.Fl i , 74c5163382SDag-Erling Smørgravinclude statistics about interrupts that have never been generated. 751c1f145fSMike Pritchard.It Fl c 769b50d902SRodney W. GrimesRepeat the display 771c1f145fSMike Pritchard.Ar count 789b50d902SRodney W. Grimestimes. 79735df156SKris KennawayThe first display is for the time since a reboot and each subsequent 80735df156SKris Kennawayreport is for the time period since the last display. 81735df156SKris KennawayIf no repeat 82735df156SKris Kennaway.Ar count 83735df156SKris Kennawayis specified, and 84735df156SKris Kennaway.Fl w 85735df156SKris Kennawayis specified, the default is infinity, otherwise the default is one. 86bd67e96dSTim J. Robbins.It Fl f 87bd67e96dSTim J. RobbinsReport on the number 88bd67e96dSTim J. Robbins.Xr fork 2 , 89bd67e96dSTim J. Robbins.Xr vfork 2 90bd67e96dSTim J. Robbinsand 91bd67e96dSTim J. Robbins.Xr rfork 2 92bd67e96dSTim J. Robbinssystem calls since system startup, and the number of pages of virtual memory 93bd67e96dSTim J. Robbinsinvolved in each. 944adb5266SPeter Wemm.It Fl h 95*e1ba604aSBenjamin KadukChanges memory columns into more easily human readable form. 96*e1ba604aSBenjamin KadukThe default if 974adb5266SPeter Wemmstandard output is a terminal device. 984adb5266SPeter Wemm.It Fl H 99*e1ba604aSBenjamin KadukChanges memory columns into straight numbers. 100*e1ba604aSBenjamin KadukThe default if standard output 1014adb5266SPeter Wemmis not a terminal device (such as a script). 1021c1f145fSMike Pritchard.It Fl i 1039b50d902SRodney W. GrimesReport on the number of interrupts taken by each device since system 1049b50d902SRodney W. Grimesstartup. 1051c1f145fSMike Pritchard.It Fl M 1061c1f145fSMike PritchardExtract values associated with the name list from the specified 107ab82970eSRuslan Ermilov.Ar core . 1081c1f145fSMike Pritchard.It Fl N 109ab82970eSRuslan ErmilovIf 110ab82970eSRuslan Ermilov.Fl M 111ab82970eSRuslan Ermilovis also specified, 112ab82970eSRuslan Ermilovextract the name list from the specified 1131c1f145fSMike Pritchard.Ar system 114ab82970eSRuslan Ermilovinstead of the default, 115ab82970eSRuslan Ermilovwhich is the kernel image the system has booted from. 1161c1f145fSMike Pritchard.It Fl m 11729a055acSRobert WatsonReport on the usage of kernel dynamic memory allocated using 11829a055acSRobert Watson.Xr malloc 9 11929a055acSRobert Watsonby type. 1208d2fbde5SJustin T. Gibbs.It Fl n 1214faf42f3SKenneth D. MerryChange the maximum number of disks to display from the default of 2. 1224adb5266SPeter Wemm.It Fl P 1234adb5266SPeter WemmReport per-cpu system/user/idle cpu statistics. 1248d2fbde5SJustin T. Gibbs.It Fl p 1256a3e8b0aSRuslan ErmilovSpecify which types of devices to display. 1266a3e8b0aSRuslan ErmilovThere are three different 1278d2fbde5SJustin T. Gibbscategories of devices: 1289b88faecSRuslan Ermilov.Pp 1298d2fbde5SJustin T. Gibbs.Bl -tag -width indent -compact 1308d2fbde5SJustin T. Gibbs.It device type: 1319b88faecSRuslan Ermilov.Bl -tag -width 9n -compact 1328d2fbde5SJustin T. Gibbs.It da 1338d2fbde5SJustin T. GibbsDirect Access devices 1348d2fbde5SJustin T. Gibbs.It sa 1358d2fbde5SJustin T. GibbsSequential Access devices 1368d2fbde5SJustin T. Gibbs.It printer 1378d2fbde5SJustin T. GibbsPrinters 1388d2fbde5SJustin T. Gibbs.It proc 1398d2fbde5SJustin T. GibbsProcessor devices 1408d2fbde5SJustin T. Gibbs.It worm 1418d2fbde5SJustin T. GibbsWrite Once Read Multiple devices 1428d2fbde5SJustin T. Gibbs.It cd 1438d2fbde5SJustin T. GibbsCD devices 1448d2fbde5SJustin T. Gibbs.It scanner 1458d2fbde5SJustin T. GibbsScanner devices 1468d2fbde5SJustin T. Gibbs.It optical 1478d2fbde5SJustin T. GibbsOptical Memory devices 1488d2fbde5SJustin T. Gibbs.It changer 1498d2fbde5SJustin T. GibbsMedium Changer devices 1508d2fbde5SJustin T. Gibbs.It comm 1518d2fbde5SJustin T. GibbsCommunication devices 1528d2fbde5SJustin T. Gibbs.It array 1538d2fbde5SJustin T. GibbsStorage Array devices 1548d2fbde5SJustin T. Gibbs.It enclosure 1558d2fbde5SJustin T. GibbsEnclosure Services devices 1568d2fbde5SJustin T. Gibbs.It floppy 1578d2fbde5SJustin T. GibbsFloppy devices 1588d2fbde5SJustin T. Gibbs.El 1598d2fbde5SJustin T. Gibbs.Pp 1608d2fbde5SJustin T. Gibbs.It interface: 1619b88faecSRuslan Ermilov.Bl -tag -width 9n -compact 1628d2fbde5SJustin T. Gibbs.It IDE 1638d2fbde5SJustin T. GibbsIntegrated Drive Electronics devices 1648d2fbde5SJustin T. Gibbs.It SCSI 1658d2fbde5SJustin T. GibbsSmall Computer System Interface devices 1668d2fbde5SJustin T. Gibbs.It other 1678d2fbde5SJustin T. GibbsAny other device interface 1688d2fbde5SJustin T. Gibbs.El 1698d2fbde5SJustin T. Gibbs.Pp 1708d2fbde5SJustin T. Gibbs.It passthrough: 1719b88faecSRuslan Ermilov.Bl -tag -width 9n -compact 1728d2fbde5SJustin T. Gibbs.It pass 1738d2fbde5SJustin T. GibbsPassthrough devices 1748d2fbde5SJustin T. Gibbs.El 1758d2fbde5SJustin T. Gibbs.El 1768d2fbde5SJustin T. Gibbs.Pp 1778d2fbde5SJustin T. GibbsThe user must specify at least one device type, and may specify at most 1786a3e8b0aSRuslan Ermilovone device type from each category. 1796a3e8b0aSRuslan ErmilovMultiple device types in a single 1808d2fbde5SJustin T. Gibbsdevice type statement must be separated by commas. 1818d2fbde5SJustin T. Gibbs.Pp 1828d2fbde5SJustin T. GibbsAny number of 1838d2fbde5SJustin T. Gibbs.Fl p 1846a3e8b0aSRuslan Ermilovarguments may be specified on the command line. 1856a3e8b0aSRuslan ErmilovAll 1868d2fbde5SJustin T. Gibbs.Fl p 1878d2fbde5SJustin T. Gibbsarguments are ORed together to form a matching expression against which 1886a3e8b0aSRuslan Ermilovall devices in the system are compared. 1896a3e8b0aSRuslan ErmilovAny device that fully matches 1908d2fbde5SJustin T. Gibbsany 1918d2fbde5SJustin T. Gibbs.Fl p 1928d2fbde5SJustin T. Gibbsargument will be included in the 1938d2fbde5SJustin T. Gibbs.Nm 194e3f1789aSDmitry Morozovskyoutput, up to two devices, or the maximum number of devices specified 1958d2fbde5SJustin T. Gibbsby the user. 1961c1f145fSMike Pritchard.It Fl s 1979b50d902SRodney W. GrimesDisplay the contents of the 1981c1f145fSMike Pritchard.Em sum 1999b50d902SRodney W. Grimesstructure, giving the total number of several kinds of paging related 2009b50d902SRodney W. Grimesevents which have occurred since system startup. 2019d16a728SMike Pritchard.\" .It Fl t 2029d16a728SMike Pritchard.\" Report on the number of page in and page reclaims since system startup, 2039d16a728SMike Pritchard.\" and the amount of time required by each. 2041c1f145fSMike Pritchard.It Fl w 2059b50d902SRodney W. GrimesPause 2061c1f145fSMike Pritchard.Ar wait 2079b50d902SRodney W. Grimesseconds between each display. 2089b50d902SRodney W. GrimesIf no repeat 209735df156SKris Kennaway.Ar wait 210735df156SKris Kennawayinterval is specified, the default is 1 second. 2118b10473dSSean BrunoThe 2128b10473dSSean Bruno.Nm 2138b10473dSSean Brunocommand will accept and honor a non-integer number of seconds. 214d662d4b7SKris Kennaway.It Fl z 21529a055acSRobert WatsonReport on memory used by the kernel zone allocator, 21629a055acSRobert Watson.Xr uma 9 , 21729a055acSRobert Watsonby zone. 2181c1f145fSMike Pritchard.El 2191c1f145fSMike Pritchard.Pp 220*e1ba604aSBenjamin KadukThe 221*e1ba604aSBenjamin Kaduk.Ar wait 222*e1ba604aSBenjamin Kadukand 223*e1ba604aSBenjamin Kaduk.Ar count 224*e1ba604aSBenjamin Kadukarguments may be given after their respective flags at any point 225*e1ba604aSBenjamin Kadukon the command line before the 226*e1ba604aSBenjamin Kaduk.Ar disks 227*e1ba604aSBenjamin Kadukargument(s), or without their flags, as the final argument(s). 228*e1ba604aSBenjamin KadukThe latter form is accepted for backwards compatibility, but it is 229*e1ba604aSBenjamin Kadukpreferred to use the forms with 230*e1ba604aSBenjamin Kaduk.Fl w 231*e1ba604aSBenjamin Kadukand 232*e1ba604aSBenjamin Kaduk.Fl c 233*e1ba604aSBenjamin Kadukto avoid ambiguity. 234*e1ba604aSBenjamin Kaduk.Pp 2359b50d902SRodney W. GrimesBy default, 236495aeceaSPhilippe Charnier.Nm 2379b50d902SRodney W. Grimesdisplays the following information: 2381c1f145fSMike Pritchard.Bl -tag -width indent 2391c1f145fSMike Pritchard.It procs 2409b50d902SRodney W. GrimesInformation about the numbers of processes in various states. 2411c1f145fSMike Pritchard.Pp 2421c1f145fSMike Pritchard.Bl -tag -width indent -compact 2431c1f145fSMike Pritchard.It r 2441c1f145fSMike Pritchardin run queue 2451c1f145fSMike Pritchard.It b 2461c1f145fSMike Pritchardblocked for resources (i/o, paging, etc.) 2471c1f145fSMike Pritchard.It w 2481c1f145fSMike Pritchardrunnable or short sleeper (< 20 secs) but swapped 2491c1f145fSMike Pritchard.El 2501c1f145fSMike Pritchard.It memory 2519b50d902SRodney W. GrimesInformation about the usage of virtual and real memory. 2529b50d902SRodney W. GrimesVirtual pages (reported in units of 1024 bytes) are considered active if 2539b50d902SRodney W. Grimesthey belong to processes which are running or have run in the last 20 2549b50d902SRodney W. Grimesseconds. 2551c1f145fSMike Pritchard.Pp 2561c1f145fSMike Pritchard.Bl -tag -width indent -compact 2571c1f145fSMike Pritchard.It avm 2581c1f145fSMike Pritchardactive virtual pages 2591c1f145fSMike Pritchard.It fre 2601c1f145fSMike Pritchardsize of the free list 2611c1f145fSMike Pritchard.El 2621c1f145fSMike Pritchard.It page 2639b50d902SRodney W. GrimesInformation about page faults and paging activity. 2649b50d902SRodney W. GrimesThese are averaged each five seconds, and given in units per second. 2651c1f145fSMike Pritchard.Pp 2661c1f145fSMike Pritchard.Bl -tag -width indent -compact 2679d16a728SMike Pritchard.It flt 2689d16a728SMike Pritchardtotal number of page faults 2691c1f145fSMike Pritchard.It re 2701c1f145fSMike Pritchardpage reclaims (simulating reference bits) 2719d16a728SMike Pritchard.\" .It at 2729d16a728SMike Pritchard.\" pages attached (found in free list) 2731c1f145fSMike Pritchard.It pi 2741c1f145fSMike Pritchardpages paged in 2751c1f145fSMike Pritchard.It po 2761c1f145fSMike Pritchardpages paged out 2771c1f145fSMike Pritchard.It fr 2781c1f145fSMike Pritchardpages freed per second 2799d16a728SMike Pritchard.\" .It de 2809d16a728SMike Pritchard.\" anticipated short term memory shortfall 2811c1f145fSMike Pritchard.It sr 2821c1f145fSMike Pritchardpages scanned by clock algorithm, per-second 2831c1f145fSMike Pritchard.El 2841c1f145fSMike Pritchard.It disks 2859b50d902SRodney W. GrimesDisk operations per second (this field is system dependent). 2869b50d902SRodney W. GrimesTypically paging will be split across the available drives. 2878d2fbde5SJustin T. GibbsThe header of the field is the first two characters of the disk name and 2889b50d902SRodney W. Grimesthe unit number. 289e3f1789aSDmitry MorozovskyIf more than two disk drives are configured in the system, 290495aeceaSPhilippe Charnier.Nm 291e3f1789aSDmitry Morozovskydisplays only the first two drives, unless the user specifies the 2928d2fbde5SJustin T. Gibbs.Fl n 2936a3e8b0aSRuslan Ermilovargument to increase the number of drives displayed. 2946a3e8b0aSRuslan ErmilovThis will probably 2958d2fbde5SJustin T. Gibbscause the display to exceed 80 columns, however. 2969b50d902SRodney W. GrimesTo force 297495aeceaSPhilippe Charnier.Nm 2989b50d902SRodney W. Grimesto display specific drives, their names may be supplied on the command line. 299084e1980SPhilippe CharnierThe 3008d2fbde5SJustin T. Gibbs.Nm 301084e1980SPhilippe Charnierutility 3028d2fbde5SJustin T. Gibbsdefaults to show disks first, and then various other random devices in the 303e3f1789aSDmitry Morozovskysystem to add up to two devices, if there are that many devices in the 3046a3e8b0aSRuslan Ermilovsystem. 3056a3e8b0aSRuslan ErmilovIf devices are specified on the command line, or if a device type 3068d2fbde5SJustin T. Gibbsmatching pattern is specified (see above), 3078d2fbde5SJustin T. Gibbs.Nm 3088d2fbde5SJustin T. Gibbswill only display the given devices or the devices matching the pattern, 3098d2fbde5SJustin T. Gibbsand will not randomly select other devices in the system. 3101c1f145fSMike Pritchard.It faults 3119b50d902SRodney W. GrimesTrap/interrupt rate averages per second over last 5 seconds. 3121c1f145fSMike Pritchard.Pp 3131c1f145fSMike Pritchard.Bl -tag -width indent -compact 3141c1f145fSMike Pritchard.It in 3151c1f145fSMike Pritcharddevice interrupts per interval (including clock interrupts) 3161c1f145fSMike Pritchard.It sy 3171c1f145fSMike Pritchardsystem calls per interval 3181c1f145fSMike Pritchard.It cs 3191c1f145fSMike Pritchardcpu context switch rate (switches/interval) 3201c1f145fSMike Pritchard.El 3211c1f145fSMike Pritchard.It cpu 3229b50d902SRodney W. GrimesBreakdown of percentage usage of CPU time. 3231c1f145fSMike Pritchard.Pp 3241c1f145fSMike Pritchard.Bl -tag -width indent -compact 3251c1f145fSMike Pritchard.It us 3261c1f145fSMike Pritcharduser time for normal and low priority processes 3271c1f145fSMike Pritchard.It sy 3281c1f145fSMike Pritchardsystem time 3291c1f145fSMike Pritchard.It id 3301c1f145fSMike Pritchardcpu idle 3311c1f145fSMike Pritchard.El 3321c1f145fSMike Pritchard.El 3336c7216dfSRuslan Ermilov.Sh FILES 3346c7216dfSRuslan Ermilov.Bl -tag -width /boot/kernel/kernel -compact 3356c7216dfSRuslan Ermilov.It Pa /boot/kernel/kernel 3366c7216dfSRuslan Ermilovdefault kernel namelist 3376c7216dfSRuslan Ermilov.It Pa /dev/kmem 3386c7216dfSRuslan Ermilovdefault memory file 3396c7216dfSRuslan Ermilov.El 3401c1f145fSMike Pritchard.Sh EXAMPLES 3411c1f145fSMike PritchardThe command: 3421c1f145fSMike Pritchard.Dl vmstat -w 5 3431c1f145fSMike Pritchardwill print what the system is doing every five 3449b50d902SRodney W. Grimesseconds; this is a good choice of printing interval since this is how often 3459b50d902SRodney W. Grimessome of the statistics are sampled in the system. 3469b50d902SRodney W. GrimesOthers vary every second and running the output for a while will make it 3479b50d902SRodney W. Grimesapparent which are recomputed every second. 3488d2fbde5SJustin T. Gibbs.Pp 3498d2fbde5SJustin T. GibbsThe command: 3508d2fbde5SJustin T. Gibbs.Dl vmstat -p da -p cd -w 1 351e3f1789aSDmitry Morozovskywill tell vmstat to select the first two direct access or CDROM devices 3528d2fbde5SJustin T. Gibbsand display statistics on those devices, as well as other systems 3538d2fbde5SJustin T. Gibbsstatistics every second. 3541c1f145fSMike Pritchard.Sh SEE ALSO 3551c1f145fSMike Pritchard.Xr fstat 1 , 3561c1f145fSMike Pritchard.Xr netstat 1 , 3571c1f145fSMike Pritchard.Xr nfsstat 1 , 3581c1f145fSMike Pritchard.Xr ps 1 , 3591c1f145fSMike Pritchard.Xr systat 1 , 36029a055acSRobert Watson.Xr libmemstat 3 , 36126d8ca83SGiorgos Keramidas.Xr gstat 8 , 3621c1f145fSMike Pritchard.Xr iostat 8 , 3630b5c9ae2SDag-Erling Smørgrav.Xr pstat 8 , 36429a055acSRobert Watson.Xr sysctl 8 , 36529a055acSRobert Watson.Xr malloc 9 , 36629a055acSRobert Watson.Xr uma 9 3671c1f145fSMike Pritchard.Pp 3689b50d902SRodney W. GrimesThe sections starting with ``Interpreting system activity'' in 3691c1f145fSMike Pritchard.%T "Installing and Operating 4.3BSD" . 370aeaa52dbSSteve Price.Sh BUGS 3711c1f145fSMike PritchardThe 3721c1f145fSMike Pritchard.Fl c 3731c1f145fSMike Pritchardand 3741c1f145fSMike Pritchard.Fl w 3751c1f145fSMike Pritchardoptions are only available with the default output. 376