vmstat - 报告虚拟内存统计信息
vmstat [-ikpqQsSw] [-T u | d] [disks] [interval [count] [start_time]]
vmstat 报告有关内核线程、虚拟内存、磁盘、陷阱和 CPU 活动的虚拟内存统计信息。
在 MP(multi-processor,多处理器)系统上,vmstat 取各 CPU 的平均值作为输出。有关每个处理器的统计信息,请参见 mpstat(8)。
vmstat 仅支持特定设备的统计信息。有关更多常规系统统计信息,请使用 sar(1), iostat(8) 或 sar(8)。
如果不使用选项,vmstat 将显示一行自系统引导以来的虚拟内存活动摘要。
内核状态命令执行期间,系统的 state 可以更改。如果相关,状态更改消息会包括在 vmstat 输出中,格式为下列之一:
<<device added: sd0>> <<device removed: sd0>> <<processors added: 1, 3>> <<processors removed: 1, 3>>
支持以下选项:
报告每个设备的中断数。count 和 interval 不适用于 –i 选项。
报告分页活动的详细信息。此选项将分别显示以下内容:
可执行文件调进的页面数。
可执行文件调出的页面数。
可执行文件释放的页面数。
匿名调进的页面数。
匿名调出的页面数。
匿名释放的页面数。
文件系统调进的页面数。
文件系统调出的页面数。
文件系统释放的页面数。
在 zone 中执行时,如果池工具处于活动状态,则以上所有项目仅报告位于 zone 池的处理器集中的处理器上的活动。
隐藏与状态更改相关的消息。
Do not print historical information as 1st line of output.
显示自引导以来各种系统事件的总数。count 和 interval 不适用于 –s 选项。
报告交换活动而不是分页活动。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).
指定 u 表示时间的内部表示形式的印刷表示形式。请参见 time(2)。指定 d 表示标准日期格式。请参见 date(1)。
Wide display format.Headers will be more descriptive and two space gap is provided between each column.
Refer the examples section for sample outputs
Fall back to use the kstat(8) interfaces as the source of data.By default, the source of data is sstored(8)
支持下列操作数:
Displays count operand reports only.Note that the count operand does not apply to the –i and –s options.
指定哪些磁盘将优先输出(一行只能显示四个磁盘)。常用磁盘名称有 id、sd、xd 或 xy 后跟一个数字(例如,sd2、xd0,诸如此类)。
Reports each interval seconds.Note that interval operand does not apply to the –i and –s options.
Specifies the time at which to start querying the statistics.If available, sstore(1) queries historical statistics.The time operand accepts ISO8601 extended (%Y-%m-%dT%H:%M:%S) formatted times, specifically the UTC or local time forms.例如:
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.
以下命令显示系统每五秒的活动摘要。
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%
vmstat 的显示字段包括
报告处于以下三种状态中每个状态的内核线程数:
运行队列中的内核线程数
正在等待资源 I/O、分页等的被阻塞的内核线程数
正在等待处理资源完成的换出轻量级进程 (LWP) 数。
报告虚拟内存和实际内存的使用情况。
可用交换空间(字节数)
可用列表的大小(字节数)
报告有关缺页和分页活动的信息。有关以下每个活动的信息以每秒为单位提供。
页面回收数-请参见 –S 选项了解此字段的修改方式。
次要故障数-请参见 –S 选项了解此字段的修改方式。
调进的千字节数
调出的千字节数
释放的千字节数
预测的短期内存短缺 (KB)
时钟算法扫描页数
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.
报告每秒的磁盘操作数。插槽中最多可放入四盘磁带,并带有由一个字母和数字组成的标签。字母指示磁盘类型(s = SCSI、i = IPI,诸如此类);数字是逻辑单元号。
报告陷阱/中断速率(每秒)。
中断
系统调用
CPU 上下文切换
在 zone 中执行时,如果池工具处于活动状态,则以上所有项目仅报告位于 zone 池的处理器集中的处理器上的活动。
提供 CPU 时间使用情况的百分比细分。在 MP 系统上,这是所有处理器的平均值。
用户时间
系统时间
idle time
在 zone 中执行时,如果池工具处于活动状态,则以上所有项目仅报告位于 zone 池的处理器集中的处理器上的活动。
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示例 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示例 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示例 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(7):
|
调用正在发展中。用户可读的输出不稳定。
date(1), sar(1), time(2), attributes(7), iostat(8), mpstat(8), sar(8)
由于百分比图生成过程中的舍入误差,CPU 使用率总量可能与 100 稍有不同。
在某些虚拟化系统(例如内核区域)上(请参见 solaris-kz(7)),由于主机系统窃取 CPU 时间,因此报告的 CPU 利用率总量可能低于 100%。mpstat(8) 命令可用来报告窃取的时间。
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.