标签:paper linux pass pid files measure man page git
gddg:~ # lsof /dev/xvda2 |head COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME init 1 root cwd DIR 202,240962 / init 1 root rtd DIR 202,240962 / init 1 root txt REG 202,240784193218 /sbin/init init 1 root mem REG 202,2191148063 /lib64/libdl-2.11.1.so init 1 root mem REG 202,216614548057 /lib64/libc-2.11.1.so init 1 root mem REG 202,22363848114 /lib64/libsepol.so.1 init 1 root mem REG 202,21139048115 /lib64/libselinux.so.1 init 1 root mem REG 202,21497978050 /lib64/ld-2.11.1.so kthreadd 2 root cwd DIR 202,240962 /
然后可以通过 lsof -p $pid 查看详情
gddg:~ # lsof -p 32597 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME bash 32597 root cwd DIR 202,2409616097 /root bash 32597 root rtd DIR 202,240962 / bash 32597 root txt REG 202,258401632203 /bin/bash bash 32597 root mem REG 202,22939368125 /lib64/libncurses.so.5.6 bash 32597 root mem REG 202,216614548057 /lib64/libc-2.11.1.so bash 32597 root mem REG 202,2191148063 /lib64/libdl-2.11.1.so bash 32597 root mem REG 202,22635688153 /lib64/libreadline.so.5.2 bash 32597 root mem REG 202,21497978050 /lib64/ld-2.11.1.so bash 32597 root mem REG 202,221701616498 /var/run/nscd/passwd bash 32597 root mem REG 202,2256324149503 /usr/lib/locale/en_US.utf8/LC_CTYPE bash 32597 root mem REG 202,254149490 /usr/lib/locale/en_US.utf8/LC_NUMERIC bash 32597 root mem REG 202,22454133112 /usr/lib/locale/en_US.utf8/LC_TIME bash 32597 root mem REG 202,21163682149504 /usr/lib/locale/en_US.utf8/LC_COLLATE bash 32597 root mem REG 202,2286133111 /usr/lib/locale/en_US.utf8/LC_MONETARY bash 32597 root mem REG 202,257149408 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES bash 32597 root mem REG 202,234149428 /usr/lib/locale/en_US.utf8/LC_PAPER bash 32597 root mem REG 202,277149438 /usr/lib/locale/en_US.utf8/LC_NAME bash 32597 root mem REG 202,2155133108 /usr/lib/locale/en_US.utf8/LC_ADDRESS bash 32597 root mem REG 202,259149407 /usr/lib/locale/en_US.utf8/LC_TELEPHONE bash 32597 root mem REG 202,223149429 /usr/lib/locale/en_US.utf8/LC_MEASUREMENT bash 32597 root mem REG 202,226050149293 /usr/lib64/gconv/gconv-modules.cache
2. cat /proc/$pid/io
如果内核版本大于2.6.20,通过cat /proc/pid/io 便可以获取进程的io信息。详细解释
gddg:~ # cat /proc/4140/io rchar: 197448798054// 读出的总字节数,read()或者pread()中的长度参数总和(pagecache中统计而来,不代表实际磁盘的读入) wchar: 209896059897// 写入的总字节数,write()或者pwrite()中的长度参数总和 syscr: 6491904// read()或者pread()总的调用次数 syscw: 13633940// write()或者pwrite()总的调用次数 read_bytes: 49616125952// 实际从磁盘中读取的字节总数 write_bytes: 14038130688// 实际写入到磁盘中的字节总数 cancelled_write_bytes: 2473984// 由于截断pagecache导致应该发生而没有发生的写入字节数
3. block_dump
通过echo 1 > /proc/sys/vm/block_dump ,来把 block 读写(WRITE/READ/DIRTY)状况 dump 到日志里,通过 dmesg 命令来查看
标签:paper linux pass pid files measure man page git
原文地址:http://www.cnblogs.com/gipagod/p/6806610.html