vmstat 使用

介绍

vmstat  是一个可以展示多种类的性能指标的一个工具:进程、内存、cpu、磁盘io 等。它输出的报告中比top 要全面,有些指标top没有,比如美妙上下文切换次数,中断次数等。

 

man vmstat查看

VMSTAT(8)                                                                              System Administration                                                                              VMSTAT(8)

NAME
       vmstat - Report virtual memory statistics

SYNOPSIS
       vmstat [options] [delay [count]]

DESCRIPTION
       vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.

       The first report produced gives averages since the last reboot.  Additional reports give information on a sampling period of length delay.  The process and memory reports are instantaneous
       in either case.

注意:description 中第二行表示vmstat 输出的报告中统计的是自动服务器开机启动以来的性能指标的平均值。额外的报告提供了关于长度延迟采样周期的信息。进程和内存报告是即时的无论哪种情况。

 

使用介绍

vmstat 2 1
procs -----------memory---------- ---swap--        -----io----    -system--       ------cpu-----
 r  b    swpd   free              buff  cache       si   so       bi    bo        in   cs us sy id wa st
 3  6      0   12464388           7504   82244384    0    0       45   101        0    0  5  1 93  1  0

#输出频率为2s,一共输出一次,如果不指定输出次数默认一直输出。

输出各项含义,介绍几个重点指标

cpu区域

cs(context switch)是每秒上下文切换的次数。

in(interrupt)则是每秒中断的次数。

r(Running or Runnable)是就绪队列的长度,也就是正在运行和等待 CPU 的进程数。

b(Blocked)则是处于不可中断睡眠状态的进程数。

 

posted @ 2021-01-03 20:11  fanggege  阅读(216)  评论(0编辑  收藏  举报