How to find per-process I/O statistics on Linux
以下转自http://www.xaprb.com/blog/2009/08/23/how-to-find-per-process-io-statistics-on-linux/
Newer Linux kernels have per-process I/O accounting and you can use the iotop tool to find out what’s performing I/O, but in many cases I’m trying to find the source of an I/O problem in an older kernel. I found sort of a hack-ish way to do that today, while trying to figure out why a system was basically unresponsive.
I found a post on Stack Overflow that showed a way you can get per process I/O statistics from the kernel even in older kernels. I adapted this to my needs, and wrote a little script.
Here’s how you use it. First, get it:
wget http://aspersa.googlecode.com/svn/trunk/iodump
Then turn on kernel messages about I/O:
echo 1 > /proc/sys/vm/block_dump
This makes the kernel start writing messages about every I/O operation that takes place. Now all you have to do is get those messages and feed them into my script:
while true; do sleep 1; dmesg -c; done | perl iodump
Wait a little while, then cancel the script. The results should look something like the following:
root@kanga:~# while true; do sleep 1; dmesg -c; done | perl iodump
^C# Caught SIGINT.
TASK PID TOTAL READ WRITE DIRTY DEVICES
firefox 4450 4538 251 4287 0 sda4, sda3
kjournald 2100 551 0 551 0 sda4
firefox 28452 185 185 0 0 sda4
kjournald 782 59 0 59 0 sda3
pdflush 31 30 0 30 0 sda4, sda3
syslogd 2485 2 0 2 0 sda3
firefox 28414 2 2 0 0 sda4, sda3
firefox 28413 1 1 0 0 sda4
firefox 28410 1 1 0 0 sda4
firefox 28307 1 1 0 0 sda4
firefox 28451 1 1 0 0 sda4
I deliberately generated a bunch of I/O by deleting my Firefox history and cache.
Add by huangbt:)
How to find per-process I/O statistics on Linux的更多相关文章
- kkjcre1p: unable to spawn jobq slave process, slot 0, error 1089(Linux x86_64)补丁
在shutdown immediately的时候,alert Log出现如下错误信息,并且不能正常关闭 kkjcre1p: unable to spawn jobq slave process, sl ...
- How to kill a process on a port on linux 怎么杀死 关掉一个端口
sudo kill `sudo lsof -t -i:9001`
- The Linux Process Principle,NameSpace, PID、TID、PGID、PPID、SID、TID、TTY
目录 . 引言 . Linux进程 . Linux命名空间 . Linux进程的相关标识 . 进程标识编程示例 . 进程标志在Linux内核中的存储和表现形式 . 后记 0. 引言 在进行Linux主 ...
- java Process的waitFor()
java Process的waitFor() 在编写Java程序时,有时候我们需要调用其他的诸如exe,shell这样的程序或脚本.在Java中提供了两种方法来启动其他程序: (1) 使用Runtim ...
- EDKII Build Process:EDKII项目源码的配置、编译流程[三]
<EDKII Build Process:EDKII项目源码的配置.编译流程[3]>博文目录: 3. EDKII Build Process(EDKII项目源码的配置.编译流程) -> ...
- process credentials(一)
一.介绍 当linux系统中的一个进程运行起来的时候,总是要访问系统的资源,访问文件或者向其他的进程发送信号.系统是否允许其进行这些操作?系统是根据什么来判断该进程的权限?这些问题是和进程信任状(pr ...
- [中英对照]Booting Process in Linux RHEL 7 | Linux RHEL 7启动过程
Booting Process in Linux RHEL 7 | Linux RHEL 7启动过程 In this post, I will guide you booting process in ...
- 最大化 AIX 上的 Java 性能,第 4 部分: 监视流量
http://www.ibm.com/developerworks/cn/aix/library/es-Javaperf/es-Javaperf4.html 最大化 AIX 上的 Java 性能,第 ...
- psutil documentation
Quick links Home page Blog Download Forum What’s new About From project’s home page: psutil (python ...
随机推荐
- Part01、sqlalchemy 使用
一.ORM 连表 一对多 1.创建表,主动指定外键约束. 2.操作. ...
- mysql数据库从删库到跑路之mysql完整性约束
一 介绍 约束条件与数据类型的宽度一样,都是可选参数 作用:用于保证数据的完整性和一致性主要分为: PRIMARY KEY (PK) 标识该字段为该表的主键,可以唯一的标识记录 FOREIGN KEY ...
- 如何注册iClap账号?
iClap是一个以产品为基础,集成员工日常所需工具,打通项目工作流程,实现员工自我工作管理.项目管理和企业管理三个体系协同的管理规范系统. 工具/原料 iPhone/Android/浏览器 Teamb ...
- $ 一步一步学Matlab(1)——初识Matlab
本文分四步走策略:第一,Matlab是个什么玩意:第二,为什么要学Matlab:第三,怎样轻松.无痛.少走弯路地学习Matlab:第四,怎样写一个Matlab的Hello World.通过这四步走,达 ...
- timestamp类型在jsp页面输出格式化方法
jsp页面使用了iterator迭代器,迭代器中有个属性名字为time,其类型为timestamp类型的,至于为什么是这个类型嘛,就是用navicat建好数据库直接映射出来的实体类,所以就是这个类型啦 ...
- 在python3下使用OpenCV 抓取摄像头图像提取蓝色
工作中需要对摄像头进行调试, Python平台大大提高调试效率. 从网找到段代码, 可以从摄像头图像中抠出蓝色. import cv2 import numpy as np cap = cv2.Vi ...
- Maven 中央仓库搭建
Maven中央仓库搭建 搭建系统:Linux Centos 7.4 x64 安装环境:JDK1.8.maven3.5.4.nexus-3.13 下载:nexus-3.13.0-01-unix.tar. ...
- Http中Get和Post的区别(转载)
在B/S应用程序中,前台与后台的数据交互,都是通过HTML中Form表单完成的.Form提供了两种数据传输的方式——get和post.虽然它们都是数据的提交方式,但是在实际传输时确有很大的不同,并且可 ...
- JAVA多线程本质分析
多线程是Java开发中的重中之重,其重要性和难度,可见一斑.掌握并精通多线程开发,是每一个程序员的必修之课.哪怕中间的过程很痛苦,只要坚持了,并最终豁然开朗了,都是一种升华. 多线程的优化:合理利用C ...
- mybatis的操作数据库基础
1.domain类 package com.xiaostudy.mybatis.domain; /** * @desc domain类 * @author xiaostudy * */ public ...