from: http://blog.csdn.net/zhangjay/article/details/6656771
iostat
iostat用于输出CPU和磁盘I/O相关的统计信息.
命令格式:
1)iostat的 简单使用
iostat可以显示CPU和I/O系统的负载情况及分区状态信息.
直接执行iostat可以显示下面内容:
Linux 2.6.9-8.11.EVAL (ts3-150.ts.cn.tlan) 08/08/2007
avg-cpu: %user %nice %sys %iowait %idle
12.01 0.00 2.15 2.30 83.54
Device: tps Blk_read/sBlk_wrtn/s Blk_readBlk_wrtnhda
7.13 200.12 34.73 640119 111076
各个输出项目的含义如下:
avg-cpu段:%user: 在用户级别运行所使用的CPU的百分比.
%nice: nice操作所使用的CPU的百分比.
%sys: 在系统级别(kernel)运行所使用CPU的百分比.
%iowait: CPU等待硬件I/O时,所占用CPU百分比.
%idle: CPU空闲时间的百分比.
Device段:
tps: 每秒钟发送到的I/O请求数.
Blk_read /s: 每秒读取的block数.
Blk_wrtn/s: 每秒写入的block数.
Blk_read: 读入的block总数.
Blk_wrtn: 写入的block总数.
2)iostat参 数说明
iostat各个参数说明:
-c 仅显示CPU统计信息.与-d选项互斥.-d 仅显示磁盘统计信息.与-c选项互斥.
-k 以K为单位显示每秒的磁盘请求数,默认单位块.
-p device | ALL 与-x选项互斥,用于显示块设备及系统分区的统计信息.
也可以在-p后指定一个设备名,如:
# iostat-p hda
或显示所有设备
#iostat-p ALL
-t 在输出数据时,打印搜集数据的时间.
-V 打印版本号和帮助信息.
-x 输出扩展信息.
3)iostat输 出项目说明
Device:
This column gives the device (or partition) name, which is displayed as hdiskn with 2.2 kernels, for the nth device. It is displayed as devm-n with 2.4 kernels, where m is the
major number of the device, and n a distinctive number. With newer kernels, the device name as listed in the /dev directory is displayed.
tps
Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the device. Multiple logical requests can be combined into a single I/O
request to the device. A transfer is of indeterminate size.
Blk_read/s
Indicate the amount of data read from the device expressed in a number of blocks per sec-ond. Blocks are equivalent to sectors with kernels 2.4 and later and therefore have a size
of 512 bytes. With older kernels, a block is of indeterminate size.
读入块的当总数.
Blk_wrtn/s
Indicate the amount of data written to the device expressed in a number of blocks per second.
写入块的总数
Blk_read
The total number of blocks read.
每秒从驱动器读入的数据量,单位为K
Blk_wrtn
The total number of blocks written.
每秒向驱动器写入的数据量,单位为K
kB_read/s
Indicate the amount of data read from the device expressed in kilobytes per second.
读入的数据总量,单位为K/MB
kB_wrtn/s
Indicate the amount of data written to the device expressed in kilobytes per second.
写入的数据总量,单位为K/MB
kB_read
The total number of kilobytes read.
单位为K/MB
kB_wrtn
The total number of kilobytes written.
单位为K/MB
rrqm/s
The number of read requests merged per second that were queued to the device.
读请求的数量合并每秒排队到设备。
错误:将读入请求合并后,每秒发送到设备的读入请求数.
wrqm/s
The number of write requests merged per second that were queued to the device.
写请求的数量合并每秒排队到设备。
错误:将写请求合并后,每秒发送到设备的读入请求数.
r/s
The number of read requests that were issued to the device per second.
每秒发送到设备的读入请求数.
w/s
The number of write requests that were issued to the device per second.
每秒发送到设备的写入请求数.
rsec/s
The number of sectors read from the device per second.
每秒从设备读入的扇区数. 其他单位K/MB
wsec/s
The number of sectors written to the device per second.
每秒向设备写入的扇区数.
avgrq-sz
The average size (in sectors) of the requests that were issued to the device.
发送到设备的请求的平均大小,单位是扇区
avgqu-sz
The average queue length of the requests that were issued to the device.
发送到设备的请求的平均队列长度.
await
The average time (in milliseconds) for I/O requests issued to the device to be served.This includes the time spent by the requests in queue and the time spent servicing them.
请求平均执行时间.包括发送请求和执行的时间.单位是毫秒.
svctm
The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more. This field will be removed in a future
sysstat version.
发送到设备的I/O请求的平均执行时间.单位是毫秒.
%util
Percentage of CPU time during which I/O requests were issued to the device (bandwidth uti-lization for the device). Device saturation occurs when this value is close to 100%.
4)iostat示 例
#iostat显示一条统计记录,包括所有的CPU和设备.
#iostat-d 2 每隔2秒,显示一次设备统计信息.
#iostat-d 2 6 每隔2秒,显示一次设备统计信息.总共输出6次.
#iostat-x hda hdb 2 6 每隔2秒显示一次hda,hdb两个设备的扩展统计信息,共输出6次.
#iostat-p sda 2 6 每隔2秒显示一次sda及上面所有分区的统计信息,共输出6次.
#iostat-d 2 每隔2秒,显示一次设备统计信息.
#iostat-d 2 6 每隔2秒,显示一次设备统计信息.总共输出6次.
#iostat-x hda hdb 2 6 每隔2秒显示一次hda,hdb两个设备的扩展统计信息,共输出6次.
#iostat-p sda 2 6 每隔2秒显示一次sda及上面所有分区的统计信息,共输出6次.