Linux vmstat

supersimple / 2025-02-21 / 原文

通过 vmstat --help 查看usage:

vmstat [options] [delay] [count]

options 指定参数
delay    统计时间间隔
count  统计次数

options:
-a, --active           active/inactive memory
-f, --forks            number of forks since boot
-m, --slabs            slabinfo
-n, --one-header       do not redisplay header
-s, --stats            event counter statistics
-d, --disk             disk statistics
-D, --disk-sum         summarize disk statistics
-p, --partition <dev>  partition specific statistics
-S, --unit <char>      define display unit
-w, --wide             wide output
-t, --timestamp        show timestamp
-y, --no-first         skips first line of output

-h, --help     display this help and exit
-V, --version  output version information and exit

返回结果:

procs(进程统计):
    r:运行队列中的进程数量,表示正在等待 CPU 的进程数。
    b:处于不可中断状态(blocked)的进程数量。
memory(内存统计):
    swpd:使用虚拟内存(swap)的大小,表示已经交换到磁盘上的内存。
    free:空闲内存大小。
    buff:用于缓存的内存大小。
    cache:用于缓存文件的内存大小。
swap(交换分区统计):
    si:每秒从磁盘交换到内存的大小(swap in)。
    so:每秒从内存交换到磁盘的大小(swap out)。
io(输入输出统计):
    bi:每秒从块设备读取的块数量。
    bo:每秒写入到块设备的块数量。
system(系统统计):
    in:每秒中断的数量。
    cs:每秒上下文切换的数量。
cpu(CPU 统计):
    us:用户空间 CPU 使用率。
    sy:内核空间 CPU 使用率。
    id:空闲 CPU 使用率。
    wa:等待 I/O 完成的 CPU 使用率。