这几天在做多线程程序io的监控,找了很多资料,试验了各种io监控工具,包括iotop,vmstat,nmon,iopp,dstat等,没有特别理想的监控工具(这些工具各有优点,主要是不能满足我的监控需要~)。
linux是以进程为单位分配资源的,linux 2.6内核版本已经支持进程io的监控,目录在 /proc/pid/io下,主要有以下几项:
+rchar: 323934931
+wchar: 323929600
+syscr: 632687
+syscw: 632675
+read_bytes: 0
+write_bytes: 323932160
+cancelled_write_bytes: 0
对它的含义有如下解释:
+Description
+———–
+rchar
+—–
+I/O counter: chars read
+The number of bytes which this task has caused to be read from storage. This
+is simply the sum of bytes which this process passed to read() and pread().
+It includes things like tty IO and it is unaffected by whether or not actual
+physical disk IO was required (the read might have been satisfied from
+pagecache)
+