리눅스 명령어 vmstat 매뉴얼
- Operating System
- 2010. 1. 12.
리눅스 명령어 vmstat 매뉴얼
주로...
프로세스 감시에 사용됩니다.
CPU 감시라고 할 수 있죠 top 도 많이 사용되죠
[root@DIM ~]# 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 2833300 136308 286580 0 0 0 4 2 4 0 0 100 0 0
0 0 0 2833300 136308 286580 0 0 0 0 4 1031 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 32 14 1043 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 0 4 1038 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 0 7 1029 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 0 5 1045 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 0 6 1037 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 36 7 1043 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 0 7 1041 0 0 100 0 0
0 0 0 2833424 136308 286580 0 0 0 20 13 1072 0 0 100 0 0
0 0 0 2833548 136308 286580 0 0 0 0 7 1033 0 0 100 0 0
0 0 0 2833548 136308 286580 0 0 0 0 3 1045 0 0 100 0 0
이것은 1초 단위로 프로세스 사용량을 보여주라는 것인데..
저기 굵은게 높을 수록 좋은 것입니다. 참고하세요
[root@DIM ~]# vmstat -
usage: vmstat [-V] [-n] [delay [count]]
-V prints version.
-n causes the headers not to be reprinted regularly.
-a print inactive/active page stats.
-d prints disk statistics
-D prints disk table
-p prints disk partition statistics
-s prints vm table
-m prints slabinfo
-S unit size
delay is the delay between updates in seconds.
unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
count is the number of updates.
[root@DIM ~]# man vmstat
VMSTAT(8) Linux Administrator¡¯s Manual VMSTAT(8)
NAME
vmstat - Report virtual memory statistics
SYNOPSIS
vmstat [-a] [-n] [delay [ count]]
vmstat [-f] [-s] [-m]
vmstat [-S unit]
vmstat [-d]
vmstat [-p disk partition]
vmstat [-V]
DESCRIPTION
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.
The first report produced gives averages since the last reboot. Additional reports give information on a sam-
pling period of length delay. The process and memory reports are instantaneous in either case.
Options
The -a switch displays active/inactive memory, given a 2.5.41 kernel or better.
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.
The -m displays slabinfo.
The -n switch causes the header to be displayed only once rather than periodically.
The -s switch displays a table of various event counters and memory statistics. This display does not repeat.
delay is the delay between updates in seconds. If no delay is specified, only one report is printed with the
average values since boot.
count is the number of updates. If no count is specified and delay is defined, count defaults to infinity.
The -d reports disk statistics (2.5.70 or above required)
The -p followed by some partition name for detailed statistics (2.5.70 or above required)
The -S followed by k or K or m or M switches outputs between 1000, 1024, 1000000, or 1048576 bytes
The -V switch results in displaying version information.
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
NOTES
vmstat does not require special permissions.
These reports are intended to help identify system bottlenecks. Linux vmstat does not count itself as a run-
ning process.
All linux blocks are currently 1024 bytes. Old kernels may report blocks as 512 bytes, 2048 bytes, or 4096
bytes.
Since procps 3.1.9, vmstat lets you choose units (k, K, m, M) default is K (1024 bytes) in the default mode
vmstat uses slabinfo 1.1 FIXME
FILES
/proc/meminfo
/proc/stat
/proc/*/stat
SEE ALSO
iostat(1), sar(1), mpstat(1), ps(1), top(1), free(1)
BUGS
Does not tabulate the block io per device or count the number of system calls.
AUTHORS
Written by Henry Ware <al172@yfn.ysu.edu>.
Fabian Frederick <ffrederick@users.sourceforge.net> (diskstat, slab, partitions...)
Throatwobbler Ginkgo Labs 27 July 1994 VMSTAT(8)
[root@DIM ~]#
[root@DIM ~]#
[root@DIM ~]# 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 2833672 136308 286572 0 0 0 4 2 4 0 0 100 0 0
0 0 0 2833672 136308 286572 0 0 0 0 11 1031 0 0 100 0 0
0 0 0 2833524 136308 286572 0 0 0 20 11 1072 0 0 100 0 0
[root@DIM ~]#
[root@DIM ~]# vmstat -s
3631632 total memory
797960 used memory
455440 active memory
41436 inactive memory
2833672 free memory
136308 buffer memory
286572 swap cache
0 total swap
0 used swap
0 free swap
292438 non-nice user cpu ticks
2093 nice user cpu ticks
344019 system cpu ticks
459431776 idle cpu ticks
26463 IO-wait cpu ticks
1217 IRQ cpu ticks
10360 softirq cpu ticks
0 stolen cpu ticks
118937 pages paged in
17297542 pages paged out
0 pages swapped in
0 pages swapped out
7784834 interrupts
1220540616 CPU context switches
1262140929 boot time
2736576 forks
[root@DIM ~]#
[root@DIM ~]# 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
sda 6053 3717 237875 18627 2395576 1924915 34595620 1218603 0 631
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
[root@DIM ~]#