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_Linux/1672.html' target='_blank'>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]