用iopp查看每个进程的I/O数据
2009-03-17 10:57
337 查看
原贴:http://www.maycode.com/index.php/linux/34-linuxbase/1287-linux-fs.html
作者:管理员 2009-01-15 22:37
摘要:iopp是一个有效查看linux下每个进程I/O负载的工具。
If
you know me, you know I can’t pass up “I/O statistics per process.” No
way. So, after a moment of browsing the code, which is short and to the
point, I tried it out:
Sweet! Next,
It behaves just like vmstat — it loops every 5 seconds until I stop it.
So what are we looking at here? I don’t see any documentation, but I
see from the source that it’s reading /proc/[PID]/io. Unfortunately
that’s not documented in my proc manpage, but there’s a patch that provides documentation for the file’s contents.
According to that, we’re looking at the pid, the number of kibibytes
read and written (even if they came from the cache), the number of read
and write system calls, and the number of kibibytes read and written to
physical medium (i.e. not just to the OS cache). Finally we have
canceled write kibibytes, and the command name. I won’t repeat the
documentation on the canceled write bytes — it is what it sounds like,
but there’s a little bit more explanation on that patch I linked.
This tool would have been very handy to know about last week. One of
my clients was seeing a lot of disk writes from a MySQL server, and it
would have made it considerably easier to diagnose the problem.
There is one small bug — the -i flag causes idle processes not to be
printed out, but it’s applied after bytes have been transformed into
kibi/mebibytes, so any process that has zeroes after that
transformation gets filtered out. So you’ll get different output from
-i -k than you will from -i or from -i -m. I’ll see if I can find the
author’s email address and let him know about this…
用iopp查看每个进程的I/O数据
Joomla! 开源天空作者:管理员 2009-01-15 22:37
摘要:iopp是一个有效查看linux下每个进程I/O负载的工具。
If
you know me, you know I can’t pass up “I/O statistics per process.” No
way. So, after a moment of browsing the code, which is short and to the
point, I tried it out:
baron@kanga:~$ wget -q -O iopp.c "http://git.postgresql.org/?p=~markwkm/iopp.git;a=blob_plain;f=iopp.c;hb=HEAD" baron@kanga:~$ gcc -o iopp iopp.c baron@kanga:~$ ./iopp --help usage: iopp -h|--help usage: iopp [-ci] [-k|-m] [delay [count]] -c, --command display full command line -h, --help display help -i, --idle hides idle processes -k, --kilobytes display data in kilobytes -m, --megabytes display data in megabytes
Sweet! Next,
baron@kanga:~$ ./iopp -i -k 5 pid rchar wchar syscr syscw rkb wkb cwkb command 4912 2 1 0 0 0 0 0 dbus-daemon 5713 0 1 0 0 0 0 0 hald 5717 17 0 0 0 0 0 0 hald-runner 5932 0 2 0 0 0 0 0 NetworkManager 22101 94 28 0 0 0 0 0 Xorg 22238 4 4 0 0 0 0 0 pulseaudio 22684 29 55 1 0 0 0 0 firefox 26860 0 43 0 0 0 0 0 gnome-terminal
It behaves just like vmstat — it loops every 5 seconds until I stop it.
So what are we looking at here? I don’t see any documentation, but I
see from the source that it’s reading /proc/[PID]/io. Unfortunately
that’s not documented in my proc manpage, but there’s a patch that provides documentation for the file’s contents.
According to that, we’re looking at the pid, the number of kibibytes
read and written (even if they came from the cache), the number of read
and write system calls, and the number of kibibytes read and written to
physical medium (i.e. not just to the OS cache). Finally we have
canceled write kibibytes, and the command name. I won’t repeat the
documentation on the canceled write bytes — it is what it sounds like,
but there’s a little bit more explanation on that patch I linked.
This tool would have been very handy to know about last week. One of
my clients was seeing a lot of disk writes from a MySQL server, and it
would have made it considerably easier to diagnose the problem.
There is one small bug — the -i flag causes idle processes not to be
printed out, but it’s applied after bytes have been transformed into
kibi/mebibytes, so any process that has zeroes after that
transformation gets filtered out. So you’ll get different output from
-i -k than you will from -i or from -i -m. I’ll see if I can find the
author’s email address and let him know about this…
相关文章推荐
- 查看php-fpm开启的进程数以及每个进程的内存限制
- 查看php-fpm开启的进程数以及每个进程的内存限制
- Linux查看系统中的每个进程
- SQL SERVER 获取数据库中所有的表名及表中的数据量/查看每个数据库的链接打开数量
- Android查看应用数据或者跨进程查看和访问数据
- 查看SqlAzure和SQLServer中的每个表数据行数
- 00003.Oracle查看进程数据
- nethogs 查看每个进程使用的带宽
- 查看Linux下每个进程的swap使用量
- 查看SQL数据库里每个表的记录数据
- 查看php-fpm开启的进程数以及每个进程的内存限制
- 查看Linux每个进程的流量和带宽
- 信息、数据-查看MSSQL 数据库 用户每个表 占用的空间大小-by小雨
- Linux查看每个CPU负载及进程IO
- TCP/IP 笔记 6 netstat -s 命令查看每个协议统计数据
- 查看php-fpm开启的进程数以及每个进程的内存限制
- 如何通过proc目录查看每个进程的内存和swap的占用
- CentOS 6.4 查看每个进程的网络流量
- 查看SQL SERVER中指定数据库的每个表的数据量和每行记录所占用的空间
- Android 使用ptrace查看其它进程的内存数据