Skip to contentSkip to conversation

counters

DISCUSSION Manik Raina 4 participants 7 messages May 16, 2002 – May 20, 2002

lore
Share & tools
lore
#0 lore raw

anyone knows if there are counters in the linux kernel which can be read via /proc like mechanism for the following :

1. total number of bytes read by process by syscalls like read()

2. total number of bytes written by each process by syscalls like write()

thanks

#1 lore raw
Quoted 9 lines · Manik Raina

anyone knows if there are counters in the linux kernel which can be read via /proc like mechanism for the following :

1. total number of bytes read by process by syscalls like read()

2. total number of bytes written by each process by syscalls like write()

Hi,

as far as I know there's not a ready to use counter in the procfs.

BTW: What do you want to count? Do You mean timers?

It shouldn't be a problem, to write a little driver, which could make this available.

Regards
Frank

#2 lore raw
In reply to Manik Raina

Thanks for your response. What i meant was every process could have an account of how many bytes were read/written to various filesystems/sockets using read()/write() system calls.

We could dump this stuff in /proc and
it could tell us which processes are
heavily IO bound.

I am wondering if this information will
be useful to anyone.

Quoted 29 lines · Frank Schaefer
Quoted 9 lines · Manik Raina

anyone knows if there are counters in the linux kernel which can be read via /proc like mechanism for the following :

1. total number of bytes read by process by syscalls like read()

2. total number of bytes written by each process by syscalls like write()

Hi,

as far as I know there's not a ready to use counter in the procfs.

BTW: What do you want to count? Do You mean timers?

It shouldn't be a problem, to write a little driver, which could make this available.

Regards
Frank

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 7 lines · Manik Raina

Thanks for your response. What i meant was every process could have an account of how many bytes were read/written to various filesystems/sockets using read()/write() system calls.

Quoted 6 lines

We could dump this stuff in /proc and
it could tell us which processes are
heavily IO bound.

I am wondering if this information will
be useful to anyone.

Hi Manik

and sorry that I read only half of your initial post. I had a quick look at fs/read_write.c.

I don't see any hook in the functions here, to perform such a task. And here this should belong to -- shouldn't it?

the functions could add ``count'' to the procfs entry of ``current''. (just a thought) This info could be valuable - I think - if it wouldn't make a large performance issue.

Regards
Frank

#4 lore raw
In reply to Manik Raina
Quoted 7 lines · Frank Schaefer

Hi Manik

and sorry that I read only half of your initial post. I had a quick look at fs/read_write.c.

I don't see any hook in the functions here, to perform such a task. And here this should belong to -- shouldn't it?

quite right. I am wondering if any locking is required for updating some counters which one may add in task_struct or if adding counters in task_struct is acceptable at all.

#5 lore raw
In reply to Manik Raina

This is doable (some other OS's do it) but:

1) It requires some changes to the basic read/write call to gather the statistics. It also requires stashing the counters somewhere such as in the task_struct and thus requires modifying it.

2) It doesn't directly tell you about I/O statistics themselves (which are available under /proc/stat) because the I/O request may be gotten from cache, or may never be flushed from cache to disk depending on subsequent events, so it will always tend to overestimate the amount of real I/O done on the device.

Jerry Cooperstein <[email protected]>
Axian, Inc. Software Consulting and Training
4800 SW Griffith Dr., Ste. 202, Beaverton, OR 97005 USA
http://www.axian.com/

Quoted 12 lines · Manik Raina

anyone knows if there are counters in the linux kernel which can be read via /proc like mechanism for the following :

1. total number of bytes read by process by syscalls like read()

2. total number of bytes written by each process by syscalls like write()

thanks
-

#6 lore raw

that's right, but it would give one a picture how much a process --let's say-- requests I/O.

Regards
Frank

Quoted 37 lines · Jerry Cooperstein

This is doable (some other OS's do it) but:

1) It requires some changes to the basic read/write call to gather the statistics. It also requires stashing the counters somewhere such as in the task_struct and thus requires modifying it.

2) It doesn't directly tell you about I/O statistics themselves (which are available under /proc/stat) because the I/O request may be gotten from cache, or may never be flushed from cache to disk depending on subsequent events, so it will always tend to overestimate the amount of real I/O done on the device.

Jerry Cooperstein <[email protected]>
Axian, Inc. Software Consulting and Training
4800 SW Griffith Dr., Ste. 202, Beaverton, OR 97005 USA
http://www.axian.com/

Quoted 4 lines · Manik Raina

anyone knows if there are counters in the linux kernel which can be read via /proc like mechanism for the following :

Quoted 8 lines

1. total number of bytes read by process by syscalls like read()

2. total number of bytes written by each process by syscalls like write()

thanks
-

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/