I want to write tiny module which measure cpu time (on unix like system) for each request and write down values into the log. I think implement it by getrusage().
First hook (e.g. ap_hook_post_read_request) in this module should be called before the same hook in any other modules (I think APR_HOOK_REALLY_FIRST doesn't work here because other modules perhaps contain this hook with
APR_HOOK_REALLY_FIRST) because it should get values from getrusage() at the very beginning of handle request.
Second hook (e.g. ap_hook_log_transaction) in this module should be called after any other modules (APR_HOOK_REALLY_LAST is not suitable because of the same reason) because it should get values from getrusage() at the end of the request and calculate difference between previous run of getrusage() and write cpu time which spends for current request into the log.
Is it possible to implement this module in this way?
If it's possible, how can I write hook which will called before (or after) the same hook in any module (I think APR_HOOK_REALLY_FIRST and APR_HOOK_REALLY_LAST is not suitable)?
If it is impossible to implement this module in this way, could you advise me how to perform it in other way, please.