vmstat(1) — Commands
NAME
vmstat − Displays virtual memory statistics
SYNOPSIS
vmstat interval [count]
vmstat [−D | −f | −i | −M | −s | −P | −w]
The vmstat command displays system statistics for virtual memory, processes, trap, and CPU activity.
OPTIONS
−DDisplays debugging information if kmem_debug is set.
−fDisplays only statistics about the number of forks since system startup (see the fork() call).
−iDisplays the following virtual memory statistics:
# vmstat -i
Virtual Memory Statistics: (pagesize = 8192)
procs memory pages intr cpu
r w u act free wire fault cow zero react pin pout in sy cs us sy id
2 82 29 23K 12K 4906 3M 963K 834K 620 710K 0 73 30 391 0 2 98
−M
Displays information about memory usage by buckets. This information can be used for kernel debugging.
−sDisplays the following accumulated statistics along with the page size:
active pages
Total number of pages that are currently in use but can be used for paging.
inactive pages
Total number of VM pages that are allocated but are most likely to be used for paging.
free pages
Total number of unreferenced (clean) pages that are available for use.
wired pages
Total number of pages that are currently in use and cannot be used for paging (not a real list).
virtual memory page faults
Number of address translation faults that have occurred.
copy-on-write page faults
Number of copy-on-write page faults, which occur if the requested page is shared by a parent process and one or more child processes (using the fork function) and if one of the processes needs to modify the page. In this case, VM loads a new address into the translation buffer and copies the contents of the requested page into the new address for modification by the process.
zero file page faults
Number of zero-filled-on-demand page faults, which occur if VM cannot find the page in the internal data structures and if the requested page is new and has never been referenced. In this case, VM initializes a physical page (the contents of the page are zeroed out) and loads the address into the page table.
reattaches from reclaim list
Number of pages that have been faulted while on the inactive list.
pages paged in
Number of requests for pages from a pager.
pages paged out
Number of pages that have been paged out.
task and thread context switches
Number of task and thread context switches.
device interrupts
Number of nonclock device interrupts.
system calls
Number of system calls called.
−PDisplays the following accumulated statistics about physical memory use:
Total Physical Memory
Sum of the total physical memory in the machine.
Physical Memory Clusters
This statistic describes how physical memory is clustered. It shows where memory is being used (pal, os, and nvram), the starting and ending pageframes, and the total amount of memory used.
Physical Memory Use
This statistic shows a breakdown of physical memory used by the operating system (such as text, data, and bss). It contains the starting and ending pageframes, memory usage per category, and total memory used.
Managed Pages Break Down
This statistic provides snapshot of where managed physical memory resides when the vmstat command was run. It indicates the the number of pages in the free, active and inactive queues, the number of wired pages, and the number of pages held in the unified buffer cache (UBC).
WIRED Pages Break Down
This statistic describes the physical pages that are wired in memory. The fields show the number of wired pages in anonymous(vm) memory, the UBC, pages used for meta data, the kernel malloc pools, contiguous memory, and pages used for page table entries (ptes). The display typically shows:
•vm and ubc wired pages
•meta data, malloc, and contig pages
•user, kernel, and free ptepages.
−wAppends iowait information to the default output as follows:.
Virtual Memory Statistics: (pagesize = 8192)
procs memory pages intr cpu
r w u act free wire fault cow pin pout in sy cs us sy id iowait
2 82 29 23K 12K 4905 3M 963K 710K 0 73 30 391 0 2 98 0
DESCRIPTION
The value of interval is a time in seconds, causing vmstat to display statistics at the specified interval. The first report generated includes statistics for the time since the last reboot. Each subsequent report is for the specified interval only. If you specify count after interval, it specifies the number of reports generated. For example, vmstat 1 10 produces 10 reports at 1-second intervals. You cannot specify count without interval, since the first numeric argument to vmstat is always assumed to be interval.
At any time, system memory can be in use by the kernel in kseg, wired (pages that are currently in use and cannot be used for paging), on the active list (pages that are currently in use but can be used for paging), on the inactive list (pages that are allocated but are most likely to be used for paging), on the free list (pages that are clean and available for use), or used by the Unified Buffer Cache (UBC). The vmstat command does not report on the memory in kseg and memory used by the UBC.
The following values are displayed:
Process information:
rNumber of threads that are running or are runnable.
wNumber of threads waiting interruptibly.
uNumber of threads waiting uninterruptibly.
Virtual memory information:
actTotal number of pages on the active list, the inactive list (pages that are allocated but are most likely to be used for paging), and the Unified Buffer Cache (UBC) least recently used (LRU) list.
freeTotal number of pages that are clean and available for use.
wire
Total number of pages that are currently in use and cannot be used for paging (not a real list).
fault
Number of address translation faults that have occurred.
cowNumber of copy-on-write page faults, which occur if the requested page is shared by a parent process and one or more child processes (using the fork function) and if one of the processes needs to modify the page. In this case, VM loads a new address into the translation buffer and copies the contents of the requested page into the new address for modification by the process.
zero
Number of zero-filled-on-demand page faults, which occur if VM cannot find the page in the internal data structures and if the requested page is new and has never been referenced. In this case, VM initializes a physical page (the contents of the page are zeroed out) and loads the address into the page table.
react
Number of pages that have been faulted while on the inactive list.
pinNumber of requests for pages from a pager.
pout
Number of pages that have been paged out.
Interrupt information:
inNumber of nonclock device interrupts per second.
syNumber of system calls called per second.
csNumber of task and thread context switches per second.
CPU information:
usPercentage of user time for normal and priority processes.
syPercentage of system time.
idPercentage of idle time.
iowait
Percentage of iowait. If the −w option is not specified, the iowait time is included in the id statistic.
Specify −f to display fork statistics only. Specify −s for a single display of accumulated statistics, as well as page size.