2002-03-06 19:13:46

by Dario Bahena Tapia

[permalink] [raw]
Subject: getting process i/o wasted time ...

Hi linux hackers ...

I'd like to know, if there's a way to get the ammount of time wasted by a
process, while it was making i/o. I've seen that the rusage
makes available the ammount of i/o blocks, but I'm thinking in something
like:

process warawara ...
time wasted in disks i/o .... XXX
time wasted in net i/o .... XXX
etc. ???

Doest it makes sense? it could be done in linux?

I supposed ,that I can insert some system calls in the right places
in the program to make this... but I'm interested in a non-intrusive
method ...

Thanks in advance

saludos
dario estepario ...



2002-03-06 19:44:37

by Richard B. Johnson

[permalink] [raw]
Subject: Re: getting process i/o wasted time ...

On Wed, 6 Mar 2002, Dario Bahena Tapia wrote:

> Hi linux hackers ...
>
> I'd like to know, if there's a way to get the ammount of time wasted by a
> process, while it was making i/o. I've seen that the rusage
> makes available the ammount of i/o blocks, but I'm thinking in something
> like:
>
> process warawara ...
> time wasted in disks i/o .... XXX
> time wasted in net i/o .... XXX
> etc. ???
>
> Doest it makes sense? it could be done in linux?
>
> I supposed ,that I can insert some system calls in the right places
> in the program to make this... but I'm interested in a non-intrusive
> method ...
>
> Thanks in advance
>
> saludos
> dario estepario ...

Time for I/O is not generally "wasted" as you say. It is given to
other tasks. Of course if there are no other tasks that want the
CPU then, I guess, you could call it wasted.

You can measure the time from when you make a system call to
the time your code gets control back. There are several
high-resolution (rdtsc) and low resolution (gettimeofday) ways
to do this.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (799.53 BogoMips).

Bill Gates? Who?

2002-03-06 23:52:18

by Rik van Riel

[permalink] [raw]
Subject: Re: getting process i/o wasted time ...

On Wed, 6 Mar 2002, Richard B. Johnson wrote:

> Time for I/O is not generally "wasted" as you say. It is given to
> other tasks. Of course if there are no other tasks that want the
> CPU then, I guess, you could call it wasted.

I guess it may be useful to measure IO wait time in the
kernel, where IO wait time is defined as:

1) a CPU is idle

2) there are processes in D state

regards,

Rik
--
"Linux holds advantages over the single-vendor commercial OS"
-- Microsoft's "Competing with Linux" document

http://www.surriel.com/ http://distro.conectiva.com/