linux iotop

来源:互联网 发布:开淘宝店铺步骤 编辑:程序博客网 时间:2024/04/27 14:08
iotop
专门显示硬盘IO的命令,界面风格类似top命令。这个命令只有在kernel v2.6.20及以后的版本中才有。
介绍:
iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python >= 2.5 (or Python >= 2.4 with the ctypes module) and a Linux kernel >= 2.6.20 with the TASK_DELAY_ACCT and TASK_IO_ACCOUNTING options enabled.
如果python小于2.6,需要安装ctypes模块。
yum install python-ctypes
就行了。

1、直接yum安装,rh6的光盘里有包。
yum install iotop

2、命令参数介绍
# ./iotop.py --help
usage: ./iotop.py [OPTIONS]

DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling
period. SWAPIN and IO are the percentages of time the thread spent respectively
while swapping in and waiting on I/O more generally. PRIO is the I/O priority at
which the thread is running (set using the ionice command).

Controls: left and right arrows to change the sorting column, r to invert the
sorting order, o to toggle the --only option, p to toggle the --processes
option, a to toggle the --accumulated option, q to quit, any other key to force
a refresh.

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -o, --only            only show processes or threads actually doing I/O
  -b, --batch           non-interactive mode
  -n NUM, --iter=NUM    number of iterations before ending [infinite]
  -d SEC, --delay=SEC   delay between iterations [1 second]
  -p PID, --pid=PID     processes/threads to monitor [all]
  -u USER, --user=USER  users to monitor [all]
  -P, --processes       only show processes, not all threads
  -a, --accumulated     show accumulated I/O instead of bandwidth
  -k, --kilobytes       use kilobytes instead of a human friendly unit
  -t, --time            add a timestamp on each line (implies --batch)
  -q, --quiet           suppress some lines of header (implies --batch)

3、使用截图



[root@localhost tmp]# iotop -o 


iotop命令的键盘快捷键:
1、左右箭头改变排序方式,默认是按IO排序
2、r键是反向排序
3、o键是只显示有IO输出的进程
4、同样q是退出

异常处理:
在Centos5.5下执行./iotop.py
出现
CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine SWAPIN and IO %
那么需要重新编译内核
Centos6.2下正常

转载请注明文章转自:良玉的博客 [http://blog.uouo123.com]
原创粉丝点击