N天学习一个linux命令之vmstat
用途
查看系统资源整体使用情况,包括进程数量,CPU,内存,IO,swap等资源统计信息
用法
vmstat [options] [delay [ count]]
常用选项
-a
显示active/inactive内存
-f
显示forks的数量
-t
显示时间
-m
显示slab信息
-n
信息头部只输出一次,默认会周期性的输出
-s
表格形式显示事件计数器和内存的统计信息
-d
报告硬盘统计信息
-w
增加字段的宽度,显示更加易于查看
-p partition name
显示指定分区的统计信息
-S
内存显示单位(The -S followed by k or K or m or M switches outputs between 1000, 1024, 1000000, or 1048576 bytes)
-V
显示程序版本信息
实践
1 每个2秒报告一次系统情况
[root@vm ~]# vmstat 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 1022280 189004 13016 177984 8 21 46 107 313 419 2 1 96 1 0
1 0 1022280 188740 13024 178004 0 0 10 76 525 611 1 0 98 1 0
0 0 1022280 188856 13032 177996 0 0 10 12 367 402 0 1 98 1 0
0 0 1022280 188716 13032 178024 0 0 0 0 465 428 0 0 99 0 0
......
2 显示硬盘统计信息
[root@vm ~]# vmstat -d
disk- ------------reads------------ ------------writes----------- -----IO------
total merged sectors ms total merged sectors ms cur sec
ram0 0 0 0 0 0 0 0 0 0 0
ram1 0 0 0 0 0 0 0 0 0 0
ram2 0 0 0 0 0 0 0 0 0 0
ram3 0 0 0 0 0 0 0 0 0 0
ram4 0 0 0 0 0 0 0 0 0 0
ram5 0 0 0 0 0 0 0 0 0 0
ram6 0 0 0 0 0 0 0 0 0 0
ram7 0 0 0 0 0 0 0 0 0 0
ram8 0 0 0 0 0 0 0 0 0 0
ram9 0 0 0 0 0 0 0 0 0 0
ram10 0 0 0 0 0 0 0 0 0 0
ram11 0 0 0 0 0 0 0 0 0 0
ram12 0 0 0 0 0 0 0 0 0 0
ram13 0 0 0 0 0 0 0 0 0 0
ram14 0 0 0 0 0 0 0 0 0 0
ram15 0 0 0 0 0 0 0 0 0 0
loop0 0 0 0 0 0 0 0 0 0 0
loop1 0 0 0 0 0 0 0 0 0 0
loop2 0 0 0 0 0 0 0 0 0 0
loop3 0 0 0 0 0 0 0 0 0 0
loop4 0 0 0 0 0 0 0 0 0 0
loop5 0 0 0 0 0 0 0 0 0 0
loop6 0 0 0 0 0 0 0 0 0 0
loop7 0 0 0 0 0 0 0 0 0 0
sda 167694 114908 4595756 1453122 146213 1199662 10667146 3261091 0 583
disk- ------------reads------------ ------------writes----------- -----IO------
total merged sectors ms total merged sectors ms cur sec
dm-0 179304 0 3766554 1811878 1068455 0 8528160 18130295 0 542
dm-1 102612 0 820896 428945 267367 0 2138936 207822027 0 77
3 表格形式显示内存统计信息
[root@vm ~]# vmstat -s
3088360 total memory
2889484 used memory
2100284 active memory
629288 inactive memory
198876 free memory
10792 buffer memory
170184 swap cache
1675260 total swap
1028168 used swap
647092 free swap
124475 non-nice user cpu ticks
21 nice user cpu ticks
26541 system cpu ticks
4815453 idle cpu ticks
57706 IO-wait cpu ticks
5211 IRQ cpu ticks
1100 softirq cpu ticks
0 stolen cpu ticks
2300650 pages paged in
5367081 pages paged out
102312 pages swapped in
267367 pages swapped out
15726774 interrupts
21089251 CPU context switches
1521510912 boot time
76080 forks
输出字段说明
懒得翻译了,这里直接做个备份,日后查看使用
FIELD DESCRIPTION FOR VM MODE
Procs
r: The number of processes waiting for run time.
b: The number of processes in uninterruptible sleep.
Memory
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
cache: the amount of memory used as cache.
inact: the amount of inactive memory. (-a option)
active: the amount of active memory. (-a option)
Swap
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
IO
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).
System
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
FIELD DESCRIPTION FOR DISK MODE
Reads
total: Total reads completed successfully
merged: grouped reads (resulting in one I/O)
sectors: Sectors read successfully
ms: milliseconds spent reading
Writes
total: Total writes completed successfully
merged: grouped writes (resulting in one I/O)
sectors: Sectors written successfully
ms: milliseconds spent writing
IO
cur: I/O in progress
s: seconds spent for I/O
FIELD DESCRIPTION FOR DISK PARTITION MODE
reads: Total number of reads issued to this partition
read sectors: Total read sectors for partition
writes : Total number of writes issued to this partition
requested writes: Total number of write requests made for partition
FIELD DESCRIPTION FOR SLAB MODE
cache: Cache name
num: Number of currently active objects
total: Total number of available objects
size: Size of each object
pages: Number of pages with at least one active object
totpages: Total number of allocated pages
pslab: Number of pages per slab
参考资料
【1】man vmstat
【2】Linux vmstat命令实战详解
http://www.cnblogs.com/ggjucheng/archive/2012/01/05/2312625.html
【3】vmstat命令
http://man.linuxde.net/vmstat
【4】Linux inactive memory
https://unix.stackexchange.com/questions/305606/linux-inactive-memory
【5】What is active memory and inactive memory?
https://stackoverflow.com/questions/18529723/what-is-active-memory-and-inactive-memory
N天学习一个linux命令之vmstat的更多相关文章
- N天学习一个Linux命令之帮助命令:man
前言 工作中每天都在使用常用的命令和非常用的命令,忘记了用法或者参数,都会bing一下,然后如此循环.一直没有真正的系统的深入的去了解命令的用法,我决定打破它.以前看到有人,每天学习一个linux命令 ...
- N天学习一个Linux命令之free
用途 查看系统内存(物理/虚拟/缓存/共享)使用情况 用法 free [-b | -k | -m | -g | -h] [-o] [-s delay ] [-c count ] [-a] [-t] [ ...
- N天学习一个linux命令之ping
用途 检测主机是否可到达,也就是说,目标主机是否可以联网,还可以用于检测网速.通过发送ICMP ECHO_REQUEST数据包检测. 用法 ping [options] destination 常用选 ...
- N天学习一个linux命令之kill
用途 用于终止进程 用法 kill [-s signal|-p] [--] pid... kill -l [signal] 说明 1.默认发送信号15(请求终止进程,程序可以捕获,操作系统会杀死没有对 ...
- N天学习一个linux命令之du
用途 统计文件或者目录占用硬盘空间大小 用法 du [OPTION] [FILE]du [OPTION] --files0-from=F 常用参数 -a, --all统计所有文件,不仅仅是目录 -b, ...
- N天学习一个linux命令之scp
用途 通过ssh通道,不同主机之间复制文件 用法 scp [options] [user@host:]file1 [user2@host2:]file2 常用参数 -1使用 ssh 1协议 -2使用s ...
- 每天一个linux命令(36)--vmstat命令
vmstat 是 Virtual Memory Statistics(虚拟内存统计)的缩写,可对操作系统的虚拟内存.进程.CPU活动进行监控.他是对系统的整体情况进行统计,不足之处是无法对某个进程进行 ...
- 每天学习一个Linux命令-目录
在工作中总会零零散散使用到各种Linux命令,从今天开始详细的学习一下linux常用命令,坚持每天一个命令,学习的主要参考资料为: 1.竹子-博客(https://www.cnblogs.com/pe ...
- N天学习一个linux命令之umask
前言 umask不是linux命令,而是shell内置的指令,俗称用户权限掩码,用于对用户创建的文件和目录设置默认权限.默认的权限掩码是0022,也就是说新创建的文件权限是0644,新创建的目录权限是 ...
随机推荐
- [Swift通天遁地]五、高级扩展-(12)扩展故事板中的元件添加本地化功能
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- easyui -tree的详细讲解
代码的具体实现 @{ ViewBag.Title = "人员查找"; ViewBag.LeftWidth = "200px"; ViewBag ...
- ACM_新七步诗(深搜)
新七步诗 Time Limit: 2000/1000ms (Java/Others) Problem Description: 突然的一天,小锴做了一个梦,梦见自己来到了三国,而自己也成了梦寐以求的帅 ...
- 349 Intersection of Two Arrays 两个数组的交集
给定两个数组,写一个函数来计算它们的交集.例子: 给定 num1= [1, 2, 2, 1], nums2 = [2, 2], 返回 [2].提示: 每个在结果中的元素必定是唯一的. 我们 ...
- python基础篇(一)-------- 字符串的操作
1.字符串的常用操作: 已知字符串:str = "hello world zhangsan and zhangsan" 1.字符串的长度:len(str) 2.查看字符串的索引值: ...
- 解决:efi usb device has been blocked by the current security policy
解决:efi usb device has been blocked by the current security policy 问题描述:U盘装系统或者其他操作时,是因为BIOS安全策略,出现上述 ...
- PHP开发之旅-提取表单提交内容发送邮件
在实际项目开发中,我们经常需要得到用户的反馈信息并及时回复.普通的留言板有一定的内容限制,而邮件则能满足这个需求.今天给大家演示一下怎么利用PHP发送电子邮件. 1.创建表单 <form nam ...
- Windows系统文件名的最大长度
1.文件名的最大长度 Windows 通常限定文件名最多包含 260 个字符.但实际的文件名必须少于这一数值,因为完整路径(如 C:\Program Files\filename.txt)都包含在此字 ...
- 常用MySQL语句整合
常用MySQL语句整合 1. MySQL服务的配置和使用 修改MySQL管理员的口令:mysqladmin –u root password 密码字符串 如:mysqldmin –u root pas ...
- cookie和sessionStorage 、localStorage 对比
相同点:都存储在客户端 不同点:1.存储大小 cookie数据大小不能超过4k. sessionStorage和localStorage 虽然也有存储大小的限制,但比cookie大得多,可以达到5M或 ...