Hi, I’m working on more instrumentation oriented version of mod_status module and i found a problem on ‘times’ function use...
Actualy each worker update ‘worker_score->times’ struct at each connection. When the child process die, at the next request of a new child with the same worker position this value are reinitialised to zero in scoreboard… This ‘times’ value are the cumulated consumed cpu used time (number of tick used from the processus start) from start of the processus, to calculate the cpu percent used you must know the real execution time (processus uptime) of the process who consumed this cpu time… But… Actualy in the scoreboard you have only the last request time (apr_time_t worker_score->stop/start) and the instances uptime (now time– globale_score->restart_time)… not the processus uptime (now time – child restart time)… Actualy the cpu load of apache instance is calculated on comulated of all worker/child cpu tick of the apache instance divide by the apache instante up times… But this up time that are not the cumulated real execution time (uptime of each worker/child) of all active worker/child but the up time of the apache instance !!! With that way of calculating, more the apache instance run are long more this load are completely usefull… Exemple : apache 3h of 70% cpu load for one day apache running ~= 9% of apache instance cpu load at the end of the day… An apache instance are not using CPU a the same load all the time, they depand on the client request demand ! What is more interesting is to detect when the cpu load is high ! With that way of calulating the load you don’t be able to see this instant load and you are no be abel to detect this apache instance high cpu load! -> The first solution i imagine : is to adding a new field (ex : apr_time_t worker_score->restart_time) on scoreboard ‘worker_score’ structure that are updated at child start, in child_init (ap_logs_child_init in log.c) phase or in ap_update_child_status_from_indexes (scoreboard.c) with status SERVER_STARTING. -> The seconde solution (more advanced/complex) : is to adding also a new field (ex : apr_time_t worker_score->last_update_time) that are updated at now time at each ‘times’ is call in ‘ap_update_child_status_from_indexes’ function. And store now the ‘times’ <delta> (now ‘times’ – worker_score->times) in a new field worker_score->times_delta. With that you are abel to musurate more instantaneous apache cpu load… But you add two new field and one apr_time_now call at each ‘times’ call in ‘ap_update_child_status_from_indexes’ function. Without one of this solution the call to ‘times’ function in scoreboard are actualy completly usefull… And to have real total cpu load from apache instance start, they need to add a new field (ex : worker_score->total_times) (like access_count and bytes_served field) in worker_score that to be updated at worker ending (in ap_update_child_status_from_indexes(scoreboard.c) at status SERVER_DEAD or SERVER_GRACEFUL ?!) to commulated in, the last ‘times’ value. Any other sugestion/remark/question ?! If your ok with thats modifications, i can do a patch proposal for that. Best regard, Mathieu