[Nottingham] Process CPU and memory usage?
Martin
martin at ml1.co.uk
Mon Sep 22 11:33:38 UTC 2008
Camilo Mesias wrote:
>> From within a program, at intervals how can I find out how much CPU and
>> how much memory has been used so far for all child/forked processes?
>
> Take a look at getrusage(), maybe consider writing a wrapper program
> that does the stats for you (then you can reuse it directly instead of
> pasting the same code into the next project)
... But that don't work.
Two aspects, one is:
http://linux.die.net/man/2/getrusage
"for resources used by those of its children that have terminated and
have been waited for"
And two, it doesn't work... For example:
http://zwillow.blogspot.com/2006/05/broken-getrusage-in-linux.html
So is this where you must do a costly trog through all of /proc/pid...?
What do others do for this?
Cheers,
Martin
--
----------------
Martin Lomas
martin at ml1.co.uk
----------------
More information about the Nottingham
mailing list