2010-09-03 5 views
28

Я создаю плагин для Munin, чтобы отслеживать статистику названных процессов. Одним из источников информации будет /proc/[pid]/io. Но мне трудно узнать, какая разница между rchar/wchar и read_bytes/written_bytes.Понимание счетчиков в/proc/[pid]/io

Это не то же самое, что и различные значения. Что они представляют?

+0

Надеюсь, что вы не против изменений, некоторые (я в частности) не знакомы с проектами меньшинств, в меньшей степени, те, в древних языках;) –

+1

я могу жить с этим, но на самом деле это не так уж и мало. Я считаю, что он хорошо развернут. – Kvisle

ответ

56

Хотя proc manpage удручающе позади (и поэтому большинство документации/страницы справочника на что-либо не относящиеся к резака печенья разработки пользовательского пространства), этот материал, к счастью, документально полностью в Linux kernel source под Documentation/filesystems/proc.txt. Вот соответствующие биты:

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) 


wchar 
----- 

I/O counter: chars written 
The number of bytes which this task has caused, or shall cause to be written 
to disk. Similar caveats apply here as with rchar. 


read_bytes 
---------- 

I/O counter: bytes read 
Attempt to count the number of bytes which this process really did cause to 
be fetched from the storage layer. Done at the submit_bio() level, so it is 
accurate for block-backed filesystems. <please add status regarding NFS and 
CIFS at a later time> 


write_bytes 
----------- 

I/O counter: bytes written 
Attempt to count the number of bytes which this process caused to be sent to 
the storage layer. This is done at page-dirtying time. 
+2

+1 Этот намек спас мою жизнь – lupz

+0

Отлично .. Действительно полезно. – Vineeth