The command is used to obtain information about memory, system processes, paging, interrupts, block I/O, disk, and CPU scheduling.
该命令显示系统内存,系统进程,分页,中断,IO,CPU调度等信息
vmstat [options][delay [count]]
这个命令输出的是当前时刻各资源的使用情况
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
10 0 0 90732360 260196 11264492 0 0 0 2 0 0 1 1 98 0 0
r |
The number of runnable processes (running or waiting for run time) |
b |
The number of processes in uninterruptible sleep. |
swpd |
the amount of virtual memory used(发生swap) |
Free |
the amount of idle memory |
Buff |
the amount of memory used as buffers |
Cache |
the amount of memory used as cache |
Si |
Amount of memory swapped in from disk (/s) |
So |
Amount of memory swapped to disk (/s) |
Bi |
Blocks received from a block device (blocks/s) |
Bo |
Blocks sent to a block device (blocks/s) |
In |
The number of interrupts per second, including the clock |
Cs |
The number of context switches per second |
st |
Time stolen from a virtual machine.(其它的cpu参数已经在top命令中介绍过了) |
Cache主要指把disk中读取的文件存储在内存中,以便下一个进程或同一个进程的其它模块可能使用到。Cache缓存的是block,而非单个文件。
Buff主要是是cpu向disk(或者网络等其它设备)写数据时,先将数据写入buff中,当disk驱动准备好后,再一次性的写入(此时cpu已经在做别的事情了)。这样可以将多次写操作变更为一次写操作,弥补了disk的速度低于cpu速度的影响。
cache 也可以用于写,buffer 也可以用于读,两者并未有实实在在明显的界限。
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free inact active si so bi bo in cs us sy id wa st
10 0 0 80273600 2278672 42397320 0 0 0 2 0 0 1 1 98 0 0
关于active memory和inactive memory的解释可以参照文献1
131787072 K total memory
32395376 K used memory
42988008 K active memory
2280928 K inactive memory
79669488 K free memory
260720 K buffer memory
19461488 K swap cache
0 K total swap
0 K used swap
0 K free swap
4131307671 non-nice user cpu ticks
1472244 nice user cpu ticks
3397811902 system cpu ticks
439622572708 idle cpu ticks
4854950 IO-wait cpu ticks
0 IRQ cpu ticks
18575279 softirq cpu ticks
0 stolen cpu ticks
113724008 pages paged in
9915481144 pages paged out
0 pages swapped in
0 pages swapped out
202328948 interrupts
2601430576 CPU context switches
1524129412 boot time
801090252 forks
non-nice user cpu ticks |
the number of times the CPU was used for high priority processes |
nice user cpu ticks |
the number of times the CPU was used for lower priority processes |
system cpu ticks |
the number of times the CPU was used for kernel processes |
idle cpu ticks |
the number of times the CPU was idle |
IO-wait cpu ticks |
the number of times the CPU was used for input/output management |
IRQ cpu ticks |
the number of times the CPU received interrupt requests |
softirq cpu ticks |
the number of times the CPU received software interrupts |
stolen cpu ticks |
the number of times a virtual machine stole CPU time |
2 disks
7 partitions
5316253 total reads
5309 merged reads
227448337 read sectors
1167129 milli reading
465758640 writes
113744662 merged writes
19831085640 written sectors
234111941 milli writing
0 inprogress IO
10882 milli spent IO
disk- ------------reads------------ ------------writes----------- -----IO------
total merged sectors ms total merged sectors ms cur sec
sda 1931293 3442 32589136 547394 262909353 106224105 10281382024 24175971 0 5565
sdb 3384984 1867 194859521 619750 202851436 7521199 9549754584 209936175 0 5317
Total |
The total number of disk reads(writes) |
merged |
The total number of grouped reads(writes) |
sectors |
The total number of sectors that have been read in(written to) |
ms |
The total number of time it took to read(write) data from(to) the disk, in milliseconds. |
cur |
Total current disk reads or writes |
sec |
seconds spent for I/O |
cat /proc/partitions
ll /dev/sda*
sda1 reads read sectors writes requested writes
211822 1602770 0 0
显示内核使用slab内存的情况
The output consists of five columns:
1. Cache: Cached data name.
2. Num: Total active objects in the Num cache.
3. Total: The number of available objects in a specific cache.
4. Size: The size of each cached object.
5. Pages: The number of memory pages containing a cached object.