linux系统上可以使用(centos 2.6.18-144开始支持),dstat版本至少是:dstat-0.6.7-1.rf.noarch.rpm
安装
wget -c http://linux.web.psi.ch/dist/scientific/5/gfa/all/dstat-0.6.7-1.rf.noarch.rpm
rpm -Uvh dstat-0.6.7-1.rf.noarch.rpm

使用
# dstat -M topio -d -M topbio

内核低版本的用这个Python脚本

#!/usr/bin/python
# Monitoring per-process disk I/O activity
# written by http://www.vpsee.com import sys, os, time, signal, re class DiskIO:
def __init__(self, pname=None, pid=None, reads=0, writes=0):
self.pname = pname
self.pid = pid
self.reads = 0
self.writes = 0 def main():
argc = len(sys.argv)
if argc != 1:
print "usage: ./iotop"
sys.exit(0) if os.getuid() != 0:
print "must be run as root"
sys.exit(0) signal.signal(signal.SIGINT, signal_handler)
os.system('echo 1 > /proc/sys/vm/block_dump')
print "TASK PID READ WRITE"
while True:
os.system('dmesg -c > /tmp/diskio.log')
l = []
f = open('/tmp/diskio.log', 'r')
line = f.readline()
while line:
m = re.match(\
'^(\S+)\((\d+)\): (READ|WRITE) block (\d+) on (\S+)', line)
if m != None:
if not l:
l.append(DiskIO(m.group(1), m.group(2)))
line = f.readline()
continue
found = False
for item in l:
if item.pid == m.group(2):
found = True
if m.group(3) == "READ":
item.reads = item.reads + 1
elif m.group(3) == "WRITE":
item.writes = item.writes + 1
if not found:
l.append(DiskIO(m.group(1), m.group(2)))
line = f.readline()
time.sleep(1)
for item in l:
print "%-10s %10s %10d %10d" % \
(item.pname, item.pid, item.reads, item.writes) def signal_handler(signal, frame):
os.system('echo 0 > /proc/sys/vm/block_dump')
sys.exit(0) if __name__=="__main__":
main()

查看进程的io的更多相关文章

  1. Linux下查看进程IO工具iopp

    Linux下的IO检测工具最常用的是iostat,不过iostat只能查看到总的IO情况.如果要细看具体那一个程序点用的IO较高,可以使用iotop .不过iotop对内核版本和Python版本有要求 ...

  2. Linux查看进程线程个数

    1.根据进程号进行查询: # pstree -p 进程号 # top -Hp 进程号 2.根据进程名字进行查询: # pstree -p `ps -e | grep server | awk '{pr ...

  3. Linux 查看进程的线程数

    三种方法: 1. 使用top命令,具体用法是 top -H 加上这个选项,top的每一行就不是显示一个进程,而是一个线程. 2. 使用ps命令,具体用法是 ps -xH 这样可以查看所有存在的线程,也 ...

  4. 查看CPU 内存 硬盘 网络 查看进程使用的文件 uptime top ps -aux vmstat iostat iotop nload iptraf nethogs

    #安装命令 yum install  sysstat #包含 iostat vmstat yum install iotop yum install  nload yum install iptraf ...

  5. Linux 查看磁盘读写速度IO使用情况

    # 查看io进程 命令:iotop 注:DISK TEAD:n=磁盘读/每秒              DISK WRITE:n=磁盘写/每秒. 注:标黄的可查看磁盘的读写速率,下面可以看到使用的io ...

  6. [转]查看linux服务器硬盘IO读写负载

    最近一台linux服务器出现异常,系统反映很慢,相应的应用程序也无法反映,而且还出现死机的情况,经过几天的观察了解,发现服务器压力很大,主要的压力来自硬盘的IO访问已经达到100% 为了方便各位和自己 ...

  7. 使用pidstat查看进程资源使用情况

    简介 pidstat主要用于监控全部或指定进程占用系统资源的情况,如CPU,内存.设备IO.任务切换.线程等.pidstat首次运行时显示自系统启动开始的各项统计信息,之后运行pidstat将显示自上 ...

  8. 查看linux服务器硬盘IO读写负载

    最近一台linux服务器出现异常,系统反映很慢,相应的应用程序也无法反映,而且还出现死机的情况,经过几天的观察了解,发现服务器压力很大,主要的压力来自硬盘的IO访问已经达到100% 为了方便各位和自己 ...

  9. top命令查看进程列表

    top命令查看进程列表 top命令是linux下常用的性能分析工具,能实时显示系统中各个进程的资源占用状况.和win的资源管理器类似.top是一个动态显示过程,即可以通过用户按键来不断刷新当前状态,如 ...

随机推荐

  1. Alamofire数据请求

    let stringurl = "http://www.huiyunche.cn/kyleuat/banner/list" Alamofire.request(.GET,strin ...

  2. Bootstrap页面布局9 - BS列表

    列表: 无序列表(列表中项目内容没有固定的顺序), 有序列表(通常使用在一组有前后顺序的内容上), 描述列表(定义解释一组词汇) 无序列表: <ul> <li>Ueditor编 ...

  3. nginx服务器安装与启动

    nginx服务器介绍 1.nginx服务器功能 nginx服务器可以扮演:轻量级的web服务器.应用服务器.代理服务器.反向代理服务器.后台服务器.CDN缓存服务器 nginx的基本模块: 内核模块C ...

  4. register instruction pointer

    Computer Science An Overview _J. Glenn Brookshear _11th Edition We have already encountered the conc ...

  5. Delphi结构体数组指针的问题

    //这段代码在Delphi 2007和delphi 7下是可以执行的,所以正确使用结构体数组和指针应该是这样的,已验证 unit Unit1; interface uses Windows, Mess ...

  6. android studio 编程中用到的快捷键

    1.Ctrl+Alt+T可以把代码包在一块内,例如try/catch Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:0000000111 EndF ...

  7. 将ntfs分区转换为ext4分区

    转自 http://blog.csdn.net/nianhongmin/article/details/27818195 将ntfs分区转换为ext4分区 分类: Linux 2014-05-31 1 ...

  8. 蓝牙Host Controller Interface笔记

    1.概述     HCI提供了一个统一的使用蓝牙控制器(BR/EDR Controller,BR/EDR/LE Controller,LE Controller,AMP Controller等)的方法 ...

  9. SQL查询一周内过生日的用户

    SELECT birthday, )) + '-' + )) + '-' + )) AS datetime) AS Nbirthday FROM CRM_Customer WHERE birthday ...

  10. HTML5新标签和属性

    1.<time>标签(支持IE9以上和其他浏览器) 今年是<time datetime="2015-12-12">2015年</time> &l ...