Linux 命令——vmstat

vmstat是Virtual Meomory Statistics(虚拟内存统计)的缩写,可对操作系统的虚拟内存、进程、CPU活动进行监控。

语法

vmstat [ -a ] [ -f ] [ -s ] [ -p ] [ -d ] [ PhysicalVolume … ] [ Interval [ Count ] ]

  • -a: 显示活跃和非活跃内存,所显示的内容除增加inact和active
  • -f: 显示显示从系统启动至今的fork数量,Linux 新建进程用fork
  • -s: 查看内存使用的详细信息
  • -d: 查看磁盘的读/写
  • -p: 显示指定磁盘分区统计信息
  • PhysicalVolume 参数指定物理卷的名称。
vmstat
[root@iZwz9hmb50uzud432t180uZ ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0      0 148624      0 191716    0    0     2     4   19    4  1  2 97  0  0

procs 代表进程

r: 运行队列中进程数量
b: 等待IO的进程数量

memory 代表内存

swpd: 使用虚拟内存大小
free: 可用内存大小
buff: 用作缓冲的内存大小
cache: 用作缓存的内存大小

swap

si: 每秒从交换区写到内存的大小
so: 每秒写入交换区的内存大小

IO

bi: 每秒读取的块数
bo: 每秒写入的块数

system 系统

in: 每秒中断数,包括时钟中断。【interrupt】
cs: 每秒上下文切换数。 【count/second】

CPU(以百分比表示):

us: 用户进程执行时间(user time)
sy: 系统进程执行时间(system time)
id: 空闲时间(包括IO等待时间),中央处理器的空闲时间 。以百分比表示。
wa: 等待IO时间

vmstat [ Interval [ Count ] ]

Interval:间隔的秒数
Count:输出次数
vmstat 2 5 代表每2秒数输出一次,总共5次

[root@iZwz9hmb50uzud432t180uZ ~]# vmstat 2 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0      0 144452      0 191816    0    0     2     4   19    5  1  2 97  0  0
 1  0      0 144424      0 191816    0    0     0     0 1323 2746  1  2 97  0  0
 0  0      0 144424      0 191816    0    0     0     0 1311 2708  1  2 97  0  0
 0  0      0 144424      0 191816    0    0     0     0 1300 2684  1  2 97  0  0
 0  0      0 144424      0 191816    0    0     0     0 1296 2675  2  1 97  0  0
[root@iZwz9hmb50uzud432t180uZ ~]#
vmstat -f
[root@iZwz9hmb50uzud432t180uZ ~]# vmstat -f
       135775 forks
vmstat -s
[root@iZwz9hmb50uzud432t180uZ ~]# vmstat -s
      1873184 K total memory
      1537332 K used memory
      1544068 K active memory
        69608 K inactive memory
       143876 K free memory
            0 K buffer memory
       191976 K swap cache
            0 K total swap
            0 K used swap
            0 K free swap
      1851311 non-nice user cpu ticks
        33174 nice user cpu ticks
      2195418 system cpu ticks
    209939919 idle cpu ticks
        25896 IO-wait cpu ticks
      1327938 IRQ cpu ticks
        88280 softirq cpu ticks
            0 stolen cpu ticks
      4958141 pages paged in
      9526610 pages paged out
            0 pages swapped in
            0 pages swapped out
   2704827476 interrupts
   1299359819 CPU context switches
   1578973412 boot time
       135776 forks
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值