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.
vmstat报告进程、内存、页和 I/O 块、中断及 CPU信息。
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.
第一次报告启动至今的平均情况。后面的信息是按取样间隔定期显示。进程和内存信息都是瞬间的。
#vmstat 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 0 6842592 1736 5226384 0 0 0 1 1 1 0 0 100 0 0
OPTIONS 选项
delay The delay between updates in seconds. If no delay is specified, only one report is printed with the average values since boot.
取样间隔,即每隔几秒更新一次。如果没有只输出启动至今的平均情况。
#vmstat 1 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 0 6842708 1736 5226384 0 0 0 1 1 1 0 0 100 0 0 0 0 0 6842708 1736 5226384 0 0 0 0 51 121 0 0 100 0 0 0 0 0 6842708 1736 5226384 0 0 0 0 46 108 0 0 100 0 0
count Number of updates. In absence of count, when delay is defined, default is infinite.
更新的次数。如果没有指定切定义了取样间隔,则是无穷次。
-a, --active
Display active and inactive memory, given a 2.5.41 kernel or better.
2.5.41内核以后用于显示active和inactive内存。Active是指应用程序正在使用的内存;Inactive是之前的应用程序使用过的内存,但是为了以后能够快速重新加载而遗留在系统中的内存;
#vmstat -a procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free inact active si so bi bo in cs us sy id wa st 0 0 0 6842964 1365836 5773756 0 0 0 1 1 1 0 0 100 0 0
-f, --forks
The -f switch displays the number of forks since boot. This includes the fork, vfork, and clone system calls, and is equivalent to the total number of tasks created. Each process is represented by one or more tasks, depending on thread usage. This display does not repeat.
显示启动后的调用数,包含fork, vfork和克隆的系统调用,等同于总共创建的任务。一个进程根据线程使用情况可能有一个或多个任务。
#vmstat -f 1393526 forks
-m, --slabs
Displays slabinfo.显示slabinfo。
#vmstat -m Cache Num Total Size Pages fuse_inode 21 21 768 21 kvm_vcpu 0 0 16064 2 kvm_mmu_page_header 0 0 168 24 nfsd4_delegations 0 0 368 22 nfsd4_openowners 0 0 392 20 rpc_inode_cache 25 25 640 25 xfs_dqtrx 0 0 576 28 xfs_icr 0 0 144 28 xfs_ili 169390 169390 152 26 xfs_inode 1127244 1127328 1024 16 xfs_efd_item 160 260 400 20 xfs_da_state 64 64 488 16 xfs_btree_cur 76 76 208 19 xfs_log_ticket 353 396 184 22 scsi_cmd_cache 438 450 448 18 kcopyd_job 0 0 3312 9 dm_uevent 0 0 2608 12 dm_rq_target_io 0 0 424 19 UDPLITEv6 0 0 1152 28 UDPv6 112 112 1152 28 tw_sock_TCPv6 0 0 256 16 TCPv6 64 64 2048 16 cfq_queue 382 476 232 17 bsg_cmd 0 0 312 26 mqueue_inode_cache 18 18 896 18 hugetlbfs_inode_cache 52 52 608 26 configfs_dir_cache 46 46 88 46 dquot 0 0 256 16 pid_namespace 0 0 2176 15 posix_timers_cache 0 0 248 16 UDP-Lite 0 0 1024 16 ip_fib_trie 292 292 56 73 RAW 612 612 960 17 UDP 80 80 1024 16 tw_sock_TCP 176 272 256 16 TCP 102 102 1920 17 blkdev_queue 51 51 1920 17 blkdev_requests 70376 70455 384 21 blkdev_ioc 195 195 104 39 fsnotify_event_holder 18700 18700 24 170 fsnotify_event 18355 18598 120 34 sock_inode_cache 745 825 640 25 net_namespace 28 28 4224 7 shmem_inode_cache 1557 1584 680 24 Acpi-ParseExt 2856 2856 72 56 Acpi-Namespace 1992 2958 40 102 taskstats 96 96 328 24 proc_inode_cache 45997 46176 656 24 sigqueue 100 100 160 25 bdev_cache 76 76 832 19 sysfs_dir_cache 19620 19620 112 36 inode_cache 26514 26514 592 27 dentry 1722408 1722567 192 21 iint_cache 0 0 80 51 selinux_inode_security 10883 11577 80 51 buffer_head 845296 845481 104 39 vm_area_struct 24487 24606 216 18 mm_struct 200 200 1600 20 files_cache 225 225 640 25 signal_cache 442 504 1152 28 sighand_cache 278 315 2112 15 task_xstate 590 684 832 19 task_struct 457 506 2912 11 anon_vma 9521 9920 64 64 Cache Num Total Size Pages shared_policy_node 2550 2550 48 85 numa_policy 31 31 264 31 radix_tree_node 69536 69636 584 28 idr_layer_cache 345 345 2112 15 dma-kmalloc-8192 0 0 8192 4 dma-kmalloc-4096 0 0 4096 8 dma-kmalloc-2048 0 0 2048 16 dma-kmalloc-1024 0 0 1024 16 dma-kmalloc-512 0 0 512 16 dma-kmalloc-256 0 0 256 16 dma-kmalloc-128 0 0 128 32 dma-kmalloc-64 0 0 64 64 dma-kmalloc-32 0 0 32 128 dma-kmalloc-16 0 0 16 256 dma-kmalloc-8 0 0 8 512 dma-kmalloc-192 0 0 192 21 dma-kmalloc-96 0 0 96 42 kmalloc-8192 49 72 8192 4 kmalloc-4096 184 200 4096 8 kmalloc-2048 485 512 2048 16 kmalloc-1024 1712 1808 1024 16 kmalloc-512 927 1008 512 16 kmalloc-256 8123 9056 256 16 kmalloc-192 5862 6405 192 21 kmalloc-128 7650 7872 128 32 kmalloc-96 17094 17094 96 42 kmalloc-64 687907 689728 64 64 kmalloc-32 19003 19328 32 128 kmalloc-16 8448 8448 16 256 kmalloc-8 17920 17920 8 512 kmem_cache_node 320 320 64 64 kmem_cache 128 128 256 16
-n, --one-header
Display the header only once rather than periodically.只显示一次表头。
-s, --stats
Displays a table of various event counters and memory statistics. This display does not repeat.显示时间计数器和内存统计信息,不会重复。
-d, --disk
Report disk statistics (2.5.70 or above required).2.5.70内核以上显示磁盘信息。
#vmstat -s 16331568 K total memory 9488356 K used memory 5773836 K active memory 1365836 K inactive memory 6843212 K free memory 1736 K buffer memory 5226384 K swap cache 8200188 K total swap 0 K used swap 8200188 K free swap 5786965 non-nice user cpu ticks 91652 nice user cpu ticks 3658782 system cpu ticks 2778978158 idle cpu ticks 802294 IO-wait cpu ticks 212 IRQ cpu ticks 47689 softirq cpu ticks 0 stolen cpu ticks 2456734 pages paged in 17256284 pages paged out 0 pages swapped in 0 pages swapped out 878734186 interrupts 2721774223 CPU context switches 1172493713 boot time 1393536 forks
-D, --disk-sum
Report some summary statistics about disk activity.磁盘活动统计信息。
]#vmstat -D 7 disks 2 partitions 365229200 total reads 1456581 merged reads 46899177474 read sectors 2734703813 milli reading 6043002 writes 255914 merged writes 132721664 written sectors 227815975 milli writing 0 inprogress IO 190847 milli spent IO
-p, --partition device
Detailed statistics about partition (2.5.70 or above required).
2.5.70内核以上显示分区信息。
#vmstat -p /dev/md126p1 md126p1 reads read sectors writes requested writes 0 0 0 0
-S, --unit character
Switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. Note this does not change the swap (si/so) or block (bi/bo) fields.
切换输出单位:1000 (k), 1024 (K), 1000000 (m)或1048576 (M) bytes,注意不会影响swap (si/so)和block (bi/bo)。
#vmstat -S M 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 0 6682 1 5103 0 0 0 1 1 1 0 0 100 0 0
-t, --timestamp
Append timestamp to each line。每行增加时间戳。
#vmstat -t -w 1 procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- -----timestamp----- r b swpd free buff cache si so bi bo in cs us sy id wa st CST 0 0 0 6842716 1736 5226496 0 0 0 1 1 1 0 0 100 0 0 2015-06-27 14:55:20 0 0 0 6842956 1736 5226496 0 0 0 0 81 171 0 0 100 0 0 2015-06-27 14:55:21
-w, --wide
Wide output mode (useful for systems with higher amount of memory, where the default output mode suffers from unwanted column breakage). The output is wider than 80 characters per line.宽行输出,行可能超过80个字符,需要更多内存。
-V, --version
Display version information and exit. 显示版本信息并退出。
-h, --help
Display help and exit.显示帮助信息并退出。
FIELD DESCRIPTION FOR VM MODE VM模式域描述
Procs
r: The number of runnable processes (running or 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 (excluding tmpfs memory for
kernels 2.6.32+) cache内存数,kernels 2.6.32不包含tmpfs。
inact: the amount of inactive memory. (-a option) inactive内存
active: the amount of active memory. (-a option) active内存
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. 下面是总CPU时间的百分比。
us: Time spent running non-kernel code. (user time, including nice time) 非内核代码时间(用户时间,包含nice时间)
sy: Time spent running kernel code. (system time) 内核代码时间(系统时间)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. 空闲时间。内核2.5.41以前包含IO等待时间。
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. IO等待时间
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown. 虚拟机时间,Linux 2.6.11以前无效。
FIELD DESCRIPTION FOR DISK MODE 磁盘模式域描述
Reads
total: Total reads completed successfully 总成功读数
merged: grouped reads (resulting in one I/O) 组读次数(多个I/O合作一个)
sectors: Sectors read successfully 成功读扇区数
ms: milliseconds spent reading 读消耗的毫秒数
Writes
total: Total writes completed successfully 成功写数
merged: grouped writes (resulting in one I/O) 写次数(多个I/O合作一个)
sectors: Sectors written successfully 写成功读扇区数
ms: milliseconds spent writing 写消耗的毫秒数
IO
cur: I/O in progress 处理的I/O数
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 SLAB模式域描述
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 每个活动对象的页数。
NOTES 说明
vmstat does not require special permissions. vmstat的不需要特殊权限。
These reports are intended to help identify system bottlenecks. Linux vmstat does not count itself as a running process.
这些报告挚爱帮助确定系统瓶颈。 Linux的vmstat的不算本身作为一个正在运行的进程。
All linux blocks are currently 1024 bytes. Old kernels may report blocks as 512 bytes, 2048 bytes, or 4096 bytes.
所有Linux块是目前1024个字节。旧的内核可能为512字节,2048字节,或4096个字节。
Since procps 3.1.9, vmstat lets you choose units (k, K, m, M). Default is K (1024 bytes) in the default mode.
procps的3.1.9以后vmstat的让你选择的单位(K,K,M,M)。默认为K(1024字节)在默认模式。
vmstat uses slabinfo 1.1 vmstat的使用slabinfo1.1
FILES 文件
/proc/meminfo
/proc/stat
/proc/*/stat
SEE ALSO 类似命令
free(1), iostat(1), mpstat(1), ps(1), sar(1), top(1)
BUGS
Does not tabulate the block io per device or count the number of system calls.
不能基于设备计算IO块或系统调用数。
AUTHORS 作者
Henry Ware [email protected]
Fabian Frédérick [email protected](diskstat, slab, partitions...)
REPORTING BUGS BUG 报告
[email protected]
作者博客:http://my.oschina.net/u/1433482
Linux slab 分配器剖析
类型:翻译