G'Day Sean,

On Wed, Feb 13, 2008 at 12:01:08PM -0800, Sean Liu wrote:
> I also meant to ask how to measure cpu time of a process and it's children?
> Let's say we have an agent, it starts up monitoring periodically -  how do we 
> measure how much CPU time this agent and it's children ( and grand children ) 
> used?

DTrace can do this using the sched provider and vtimestamp, or in rough
terms using profile and progenyof(), eg:

# dtrace -n 'profile-1001 /pid == $target || progenyof($target)/ {
        @["on-CPU, 1001 Hertz count:"] = count(); }' -p 929727
dtrace: description 'profile-1001 ' matched 1 probe
^C

  on-CPU, 1001 Hertz count:                                       638

So PID 929727 was on-CPU for 638 samples at 1001 Hertz.

However process CPU time is already tracked by microstate accounting and
provided via procfs, and can be shown using /usr/bin/ptime.  This does
include children time (the man page needs updating).  There are other
ways to get to this procfs data...

Brendan

-- 
Brendan
[CA, USA]
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to