Re: Getting io statistics on processes.

From: Muli Ben-Yehuda (mulix_at_nonexisting.hamakor.org.il)
Date: Wed 12 Jan 2005 - 11:57:08 IST


On Wed, Jan 12, 2005 at 02:39:03AM +0200, Tzahi Fadida wrote:

> Well, it seems right. I am not sure if its all the io disk calls though.
> The code is not easy to read but it seems this is the same data
> that /proc/stat -> page line uses thru kstat.pgpgout.
> I am looking at what seems to be the point where this happens,
> at the file drivers/block/ll_rw_blk.c at function -
> void submit_bh(int rw, struct buffer_head * bh) .
> Is there a way to pull this data out without recompiling the kernel?

Depending on what data you mean, probably not.

> If not, I believe the proper way of getting out the data is to put it in
> proc in something like - /proc/<pid>/statio
> How do I do that? just create a regular file or is it something
> else?

Look for how other proc files are created in the kernel. It requires a
little bit of kernel code. Also see http://lwn.net/Kernel/LDD2/

> Ultimately I will need to read it with my c program.

You can read and parse the output you get from laptop mode.

> here is some output of the dmesg, the blocks seems to be after the "/"
> and I will need to sum them up for each process. although, it uses the
> name
> instead of PIDs so I'll need to figure out also where are the PIDs,
> I am guessing current->pid.

Right.

> also, by my understanding the dirtied buffer
> relate to memory and swap file? and not directly to files?

Which kernel version are you looking at?
A dirtied buffer will have to be flushed to disk at some point, that's
why it's interesting.

Cheers,
Muli

-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

=================================================================
To unsubscribe, send mail to linux-il-request_at_linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request_at_linux.org.il




This archive was generated by hypermail 2.1.7 : Wed 12 Jan 2005 - 12:06:35 IST