httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tser <terdu...@worldonline.nl>
Subject Re: mod_status cpu time
Date Sun, 07 Mar 1999 18:28:26 GMT
I did a little research on the mod_status :o)

Let us see what mod_status does..

For each Child
 {
		tu += score_record.times.tms_utime;
                ts += score_record.times.tms_stime;
                tcu += score_record.times.tms_cutime;
                tcs += score_record.times.tms_cstime;
 }

up_time  equals  the  current time - time server started.
Tick     equals  sysconf(_SC_CLK_TCK);


By dugging into the meaning of the class i did a Global search,landed
on http://www.opengroup.org/onlinepubs/7908799/xsh/times.html and found
out :


the tms_utime structure member is the CPU time charged for the execution
of user instructions of the calling process. 

The tms_stime structure member is the CPU time charged for execution by
the system on behalf of the calling process. 

he tms_cutime structure member is the sum of the tms_utime and
tms_cutime times of the child processes. 

The tms_cstime structure member is the sum of the tms_stime and
tms_cstime times of the child processes. 


Sow *pounders* after reading at the site:

The times of a terminated child process are included in the tms_cutime
and tms_cstime elements of the parent when wait() or waitpid() returns
the process ID of this terminated child. If a child process has not
waited for its children, their times will not be included in its times. 


Thus, we may conclude since one of the child we check in fact is the
parent itself and has also the "tcu and tcs" stored of all the times,
previuos executed tasks have caused.


so [1] (tu+ts)+ [2] (tcu+tcs) is 
   [1] (current load)  + [2] Past Load.


Where Past load also include's the current still active children
"ex-childs" load :o)


[1] and [2] combinend Gives to Total Power the Webserver has drained
from the system.


Making, the dividing by the Total Uptime, and the _SC_CLK_TCK very
logical.

ap_rprintf(r, "CPULoad: %g\n",
                    (tu + ts + tcu + tcs) / tick / up_time * 100.);


My little, humble Conclusion is, that the calculation measured inside
mod_status is
has been correct :o)




	*waves *
				- Reinder Kraaij


Jim Jagielski wrote:
> I haven't looked at that, but that sounds wrong to me :)
> Marc Slemko wrote:
> > Is it just me, or is the mod_status % CPU time completely bogus?  It takes
> > the CPU use of the current child processes, adds them up, then divides by
> > the total time the server has been up?  Erm...

Mime
View raw message