Hello, related to my previous post about getting to microsecond values from APR/mod_perl, I propose to submit to CPAN a module Apache2::RequestRec::Time which will add four functions (methods) to Apache2::RequestRec: request_time_hires, request_duration, request_duration_microseconds, and request_duration_hires.
My main goal is to be able to get value equivalent to custom log's %D (time taken to serve the request, in microseconds) from mod_perl, which request_duration_microseconds will do, and I wanted the set of methods to be a big more complete in case people wanted similar yet not exact functionality. Initially, I also planned to have request_time_microseconds but I hit integer overflows as epoch in microseconds is fairly big number. I'd appreciate any comments about suitability of such module and/or its name, purpose, or implementation (for code, see below) before I do the CPAN submission. Of course, the CPAN distribution will be complete with Makefile.PL and test. Thank you. For the reference, my planned XS code is: #include <mod_perl.h> typedef request_rec *Apache2__RequestRec; MODULE = Apache2::RequestRec::Time PACKAGE = Apache2::RequestRec PREFIX = mpxs_Apache2__RequestRec_ double mpxs_Apache2__RequestRec_request_time_hires(r) Apache2::RequestRec r CODE: RETVAL = (double)(r->request_time) / APR_USEC_PER_SEC; OUTPUT: RETVAL long mpxs_Apache2__RequestRec_request_duration(r) Apache2::RequestRec r CODE: apr_time_t duration = apr_time_now() - r->request_time; RETVAL = apr_time_sec(duration); OUTPUT: RETVAL double mpxs_Apache2__RequestRec_request_duration_microseconds(r) Apache2::RequestRec r CODE: RETVAL = (double)(apr_time_now() - r->request_time); OUTPUT: RETVAL double mpxs_Apache2__RequestRec_request_duration_hires(r) Apache2::RequestRec r CODE: RETVAL = (double)(apr_time_now() - r->request_time) / APR_USEC_PER_SEC; OUTPUT: RETVAL -- Jan Pazdziora --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org