2010-09-03 7 views
28

Ich erstelle ein Plugin für Munin, um Statistiken der genannten Prozesse zu überwachen. Eine der Informationsquellen wäre /proc/[pid]/io. Aber ich habe eine harte Zeit herauszufinden, was der Unterschied zwischen rchar/wchar und read_bytes/written_bytes ist.Die Zähler verstehen in/proc/[pid]/io

Sie sind nicht gleich, da sie unterschiedliche Werte liefern. Was repräsentieren sie?

+0

Hoffnung Sie die Änderungen nicht dagegen, einige (mich insbesondere) sind nicht vertraut mit Minderheitenprojekte, weniger diejenigen, die in alten Sprachen;) –

+1

ich kann damit leben, aber es ist nicht so klein, wirklich. Ich betrachte es als gut eingesetzt. – Kvisle

Antwort

56

Während die proc manpage woefully hinter (und so sind die meisten manpages/Dokumentation auf etwas beziehen, nicht zu Cookie-Cutter-User-Space-Entwicklung) wird dieses Zeug zum Glück vollständig im Linux kernel source unter Documentation/filesystems/proc.txt dokumentiert. Hier sind die entsprechenden Bits:

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 Dieser Hinweis rettete mein Leben – lupz

+0

Ausgezeichnet .. Wirklich hilfreich. – Vineeth