in reply to CPU Usage by VirtualHost

I am fuzzy on whether the Apache handlers and processes are parent/child, siblings, single/same process, or something else. Perhaps the times function will do the job.

times Returns a four-element list giving the user and system times, in seconds, for this process and the children of this process.
( $user, $system, $cuser, $csystem ) = times;

This code shows that times does not wait until end-of-process or I/O operation to update its data source:

$ perl -wle 'sub r{@t=times();push @out,qq{@t}} sub x{my $z; $z.=1 for + 1..1_000_000;} r; x; r; x; r;print for @out' 0 0 0 0 0.17 0 0 0 0.29 0 0 0

Replies are listed 'Best First'.
Re^2: CPU Usage by VirtualHost
by tdevil76 (Beadle) on Jun 09, 2007 at 01:57 UTC
    The handlers are run in the same process as the apache process... I will check out times.
      SO, it looks like times() uses the same cpu times from the /proc filesystem that everything else uses. I wonder what I need to do (a signal that needs to be sent maybe) to get the /proc cpu usage stats to update....