vmstat:
显示虚拟内存的统计信息,还可以报告关于进程、内存、I/O等系统整体运行状态。
选项:
-a:显示内存活动
-f:显示启动后创建的进程总数
-s:以表格方式显示时间计数器和内存状态,不能刷新显示
-d:显示磁盘状态
-p:显示指定的分区状态
-S:指定输出信息的单位
-n:状态信息刷新的时间间隔和次数
实例:
[root@master~]# vmstat
procs ----------memory------------- --swap-- ---io--- --system-- -----------cpu---------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 23016 62180 304304 0 0 69 30 584145 1 2 95 2 0
显示内容分析:
Procs
r: The number of processes waiting for run time.
b: The number of processes in uninterruptible sleep.
Memory
swpd: 已用的虚拟内存。.
free: 空闲的内存.
buff: 用作buffer的内存.
cache: 用作 cache的内存.
inact: 未激活状态的内存inactive memory. (-a option)
active: 激活状态的内存active memory. (-a option)
Swap
si: 从磁盘交换到内存的内存数量 (/s).
so: 交换到磁盘的内存数量(/s).
IO
bi: 从块设备接收的块数量 (blocks/s).
bo: 发送到块设备的块数量 (blocks/s).
System
in: 每秒的中断数量,包括时钟.
cs: 每秒的上下文切换数量.
CPU
占全部CPU时间的百分比:
us: 运行非内核(non-kernel)代码花费的时间. (user time, including nice time)
sy: 运行内核代码花费的时间. (system time)
id: 空闲时间Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: 等待IO的时间. Prior to Linux 2.5.41, included in idle.
st: 从虚拟机获取的时间. Prior to Linux 2.6.11, unknown.
[root@master~]# vmstat -s
547428 total memory
524908 used memory
230284 active memory
247108 inactive memory
22520 free memory
62620 buffer memory
304316 swap cache
2096472 total swap
0 used swap
2096472 free swap
5071 non-nice user cpu ticks
199 nice user cpu ticks
11648 system cpu ticks
707535 idle cpu ticks
16799 IO-wait cpu ticks
195 IRQ cpu ticks
529 softirq cpu ticks
0 stolen cpu ticks
489932 pages paged in
216337 pages paged out
0 pages swapped in
0 pages swapped out
4337742 interrupts
1066186 CPU context switches
1341878613 boot time
42883 forks