[Nottingham] CPU time

Martin martin at ml1.co.uk
Wed Oct 1 14:22:15 UTC 2008


Michael Simms wrote:
> Erm, someone was asking how to get the CPU time of a process and/or its
> children. I just bumped into the times() function in section 2 of the
> manual, and it seems to do what people were looking for.

Thanks for the note. But...

http://linux.die.net/man/2/times

"Times for *terminated children* (and their descendants) is added in at
the moment wait(2) or waitpid(2) returns their process ID. In
particular, times of grandchildren that the children did not wait for
are never seen."

"All times reported are in clock ticks."

See Also
time(1), getrusage(2), wait(2), clock(3), sysconf(3), time(7)


... Fine for system accounting. No good for checking up on 'progress' of
various process threads and /gracefully/ terminating any that have
exceeded limits set by the application itself.


There's "ulimit" and so on but that is rather too blunt an instrument to
use against a background task that is trying to be very 'nice'...


Looks like this is a feature that isn't enough of a problem to be
included in the kernel.

Still musing.

Cheers,
Martin


-- 
----------------
Martin Lomas
martin at ml1.co.uk
----------------



More information about the Nottingham mailing list