Go to main content

man pages section 8: System Administration Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

vmstat(8)

Name

vmstat - report virtual memory statistics

Synopsis

vmstat [-ikpqQsSw] [-T u | d] [disks] [interval [count] [start_time]]

Description

vmstat reports virtual memory statistics regarding kernel thread, virtual memory, disk, trap, and CPU activity.

On MP (multi-processor) systems, vmstat averages the number of CPUs into the output. For per-processor statistics, see mpstat(8).

vmstat only supports statistics for certain devices. For more general system statistics, use sar(1), iostat(8), or sar(8).

Without options, vmstat displays a one-line summary of the virtual memory activity since the system was booted.

During execution of the kernel status command, the state of the system can change. If relevant, a state change message is included in the vmstat output, in one of the following forms:


<<device added: sd0>>
<<device removed: sd0>>
<<processors added: 1, 3>>
<<processors removed: 1, 3>>

Options

The following options are supported:

–i

Report the number of interrupts per device. count and interval does not apply to the –i option.

–p

Report paging activity in details. This option will display the following, respectively:

epi

Executable page-ins.

epo

Executable page-outs.

epf

Executable page-frees.

api

Anonymous page-ins.

apo

Anonymous page-outs.

apf

Anonymous page-frees.

fpi

File system page-ins.

fpo

File system page-outs.

fpf

File system page-frees.

When executed in a zone and if the pools facility is active, all of the above only report activity on the processors in the processor set of the zone's pool.

–q

Suppress messages related to state changes.

–Q

Do not print historical information as 1st line of output.

–s

Display the total number of various system events since boot. count and interval does not apply to the –s option.

–S

Report on swapping rather than paging activity. This option will change two fields in vmstat's paging display: rather than the ‘re’ and ‘mf’ fields, vmstat will report ‘si’ (swap-ins) and ‘so’ (swap-outs).

–T u | d

Specify u for a printed representation of the internal representation of time. See time(2). Specify d for standard date format. See date(1).

–w

Wide display format. Headers will be more descriptive and two space gap is provided between each column.

Refer the examples section for sample outputs

–k

Fall back to use the kstat(8) interfaces as the source of data. By default, the source of data is sstored(8)

Operands

The following operands are supported:

count

Displays count operand reports only. Note that the count operand does not apply to the –i and –s options.

disks

Specifies which disks are to be given priority in the output (only four disks fit on a line). Common disk names are id, sd, xd, or xy, followed by a number (for example, sd2, xd0, and so forth).

interval

Reports each interval seconds. Note that interval operand does not apply to the –i and –s options.

start_time

Specifies the time at which to start querying the statistics. If available, sstored(8) queries historical statistics. The time operand accepts ISO8601 extended (%Y-%m-%dT%H:%M:%S) formatted times, specifically the UTC or local time forms. For example:

2021-07-14T17:06:09Z   (UTC time)
2015-07-14T16:06:09    (assumed to be local time)

When you specify the start_time operand, you must also specify the interval and count operands.

Note that the start_time does not apply to the –i, –s, and –k options.

Examples

Example 1 Using vmstat

The following command displays a summary of what the system is doing every five seconds.

example% vmstat 5


kthr   memory          page             disk      faults        cpu
r b w swap  free re mf pi p fr de sr s0 s1 s2 s3  in  sy  cs us sy id
0 0 0 11456 4120 1  41 19 1  3  0  2  0  4  0  0  48 112 130  4 14 82
0 0 1 10132 4280 0   4 44 0  0  0  0  0 23  0  0 211 230 144  3 35 62
0 0 1 10132 4616 0   0 20 0  0  0  0  0 19  0  0 150 172 146  3 33 64
0 0 1 10132 5292 0   0  9 0  0  0  0  0 21  0  0 165 105 130  1 21 78
1 1 1 10132 5496 0   0  5 0  0  0  0  0 23  0  0 183  92 134  1 20 79
1 0 1 10132 5564 0   0 25 0  0  0  0  0 18  0  0 131 231 116  4 34 62
1 0 1 10124 5412 0   0 37 0  0  0  0  0 22  0  0 166 179 118  1 33 67
1 0 1 10124 5236 0   0 24 0  0  0  0  0 14  0  0 109 243 113  4 56 39
^C

example%

The fields of vmstat's display are

kthr

Report the number of kernel threads in each of the three following states:

r

the number of kernel threads in run queue

b

the number of blocked kernel threads that are waiting for resources I/O, paging, and so forth

w

the number of swapped out lightweight processes (LWPs) that are waiting for processing resources to finish.

memory

Report on usage of virtual and real memory.

swap

available swap space (Kbytes)

free

size of the free list (Kbytes)

page

Report information about page faults and paging activity. The information on each of the following activities is given in units per second.

re

page reclaims — but see the –S option for how this field is modified.

mf

minor faults — but see the –S option for how this field is modified.

pi

kilobytes paged in

po

kilobytes paged out

fr

kilobytes freed

de

anticipated short-term memory shortfall (Kbytes)

sr

pages scanned by clock algorithm

When executed in a zone and if the pools facility is active, all of the above (except for ‘de’) only report activity on the processors in the processor set of the zone's pool.

disk

Report the number of disk operations per second. There are slots for up to four disks, labeled with a single letter and number. The letter indicates the type of disk (s = SCSI, i = IPI, and so forth); the number is the logical unit number.

faults

Report the trap/interrupt rates (per second).

in

interrupts

sy

system calls

cs

CPU context switches

When executed in a zone and if the pools facility is active, all of the above only report activity on the processors in the processor set of the zone's pool.

cpu

Give a breakdown of percentage usage of CPU time. On MP systems, this is an average across all processors.

us

user time

sy

system time

id

idle time

When executed in a zone and if the pools facility is active, all of the above only report activity on the processors in the processor set of the zone's pool.

Example 2 vmstat wide display sample-1
example% vmstat -w
  Kernel_Threads      Virtual_Memory                        Paging_Info                      Disk_Ops/s      Faults_per_sec         CPU_Usage
 Run  Block  Wait  Swap(KBs)  Free(KBs)  Reclaim  MinorFault PageIn  PageOut  Freed  Def  Scan  s0 s1 s2 s3  Intr  Syscal  CPU_Sw  User%  Sys%  Idle%  Time
 15   0      0     118713700  56911268   16274    141727     14      0        0      0    0     38 38 33 33  9496  129607  5687    21     8     72     Wed Dec 16 21:59:26 PST 2020
Example 3 vmstat wide display sample-2
example% vmstat -Sw
  Kernel_Threads      Virtual_Memory                        Paging_Info                      Disk_Ops/s      Faults_per_sec         CPU_Usage
 Run  Block  Wait  Swap(KBs)  Free(KBs)  SwapIn  SwapOut  PageIn  PageOut  Freed  Def  Scan  s0 s1 s2 s3  Intr  Syscal  CPU_Sw  User%  Sys%  Idle%  Time
 15   0      0     118714260  56911844   0       0        14      0        0      0    0     38 38 33 33  9496  129608  5687    21     8     72     Wed Dec 16 21:59:24 PST 2020
Example 4 vmstat wide display sample-3
example% vmstat -wp
    Virtual_Memory                  Paging_Info                      Executable               Anonymous_Pages              Filesystem
 Swap(KBs)  Free(KBs)  Reclaim  MinorFault  Freed  Def  Scan  PageIn  PageOut  PageFree  PageIn  PageOut  PageFree  PageIn  PageOut  PageFree  Time
 114023436  52311932   17876    156365      0      0    0     0       0        0         3       0        0         10      0        0         Thu Dec 17 03:04:51 PST 2020
Example 5 vmstat viewing historical data

The following example shows how to create a report that contains historical statistics since 2021-September-27 06:11:04+05:30. The statistics are output every second for ten times.

example% vmstat 1 10 2021-09-27T6:11:04+5:30
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr vc -- -- --   in   sy   cs us sy id
 0 0 0 3226613 1208475 1  1  0  0  0  0  0  0  0  0  0  464   87  382  0  0 100
 0 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  518  304  464  0  0 100
 2 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  485  305  400  0  0 100
 0 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  510  307  384  0  0 100
 0 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  501  306  420  0  0 100
 1 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  522  317  433  0  0 99
 1 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  511  311  412  0  0 100
 0 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  471  303  382  0  0 100
 1 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  502  308  413  0  0 100
 0 0 0 3602720 1587608 0  0  0  0  0  0  0  0  0  0  0  470  302  396  0  0 100
      

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
Interface Stability
See below

Invocation is evolving. Human readable output is unstable.

See Also

date(1), sar(1), time(2), attributes(7), iostat(8), mpstat(8), sar(8)

Notes

The sum of CPU utilization might vary slightly from 100 because of rounding errors in the production of a percentage figure.

On some virtualized systems, such as a kernel zone (see solaris-kz(7)), the sum of CPU utilization reported may be below 100 due to CPU time stolen by the host system. The mpstat(8) command can be used to report stolen time.

In order to view historical data via vmstat, the sstore collection vm-stats must have been enabled for the time period being observed. Refer to sstoreadm(1) for more information about enabling a sstore collection.