vmstat用于统计虚拟内存

能够获取的信息包括

  1. 正在运行的进程个数
  2. CPU的使用情况
  3. CPU接收的中断个数
  4. 调度器执行的上下文切换次数

一个典型的输出为

image-20220525105923879

输出含义为:

VM Mode

  1. Procs:
    1. r: 运行的进程数
    2. b: sleep的进程数
  2. Memory
    1. swpd: 虚拟内存使用量
    2. free: 空闲内存量
    3. buff: 缓冲区的内存量
    4. cache: 缓存内存量
    5. inact: the amount of inactive memory. (-a option)
    6. active: the amount of active memory. (-a option)
  3. Swap
    1. si: Amount of memory swapped in from disk (/s).
    2. so: Amount of memory swapped to disk (/s).
  4. IO
    1. bi: Blocks received from a block device (blocks/s).
    2. bo: Blocks sent to a block device (blocks/s).
  5. System
    1. in: The number of interrupts per second, including the clock.(中断)
    2. cs: The number of context switches per second.(上下文切换)
  6. CPU : percentages of total CPU time.
    1. us: Time spent running non-kernel code. (user time, including nice time)
    2. sy: Time spent running kernel code. (system time)
    3. id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
    4. wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
    5. st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

Disk Mode

  1. Reads
    1. total: Total reads completed successfully
    2. merged: grouped reads (resulting in one I/O)
    3. sectors: Sectors read successfully
    4. ms: milliseconds spent reading
  2. Writes
    1. total: Total writes completed successfully
    2. merged: grouped writes (resulting in one I/O)
    3. sectors: Sectors written successfully
    4. ms: milliseconds spent writing
  3. IO
    1. cur: I/O in progress
    2. s: seconds spent for I/O