iotop (/proc/PID/io)


LinuxI/O問題の切り分けが難しい印象だったが,Kernel 2.6.20で "IO Accounting"機能が実装された. CONFIG_TASK_IO_ACCOUNTINGパラメタで有効にすることができ,/proc/<$PID>/io から プロセス毎のリアルタイム I/O 情報 が取得できるようになる.

IO Accounting

The present per-task IO accounting isn't very useful. It simply counts the number of bytes passed into read() and write(). So if a process reads 1MB from an already-cached file, it is accused of having performed 1MB of I/O, which is 'wrong'. So this IO accounting implements per-process statistics of "storage I/O" (i.e.: I/O that really does I/O on the storage device - Linux already had I/O storage statistics but it's not per-task). The data is reported through taskstats and procfs (/proc/$PID/io)