Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 88339 invoked from network); 13 Aug 2009 19:22:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Aug 2009 19:22:17 -0000 Received: (qmail 62845 invoked by uid 500); 13 Aug 2009 19:22:23 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 62804 invoked by uid 500); 13 Aug 2009 19:22:23 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 62796 invoked by uid 99); 13 Aug 2009 19:22:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 19:22:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jpz-mlmp@adelton.com designates 69.61.82.84 as permitted sender) Received: from [69.61.82.84] (HELO relay.adelton.com) (69.61.82.84) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 19:22:14 +0000 Received: from adelton by relay.adelton.com with local (envelope-from ) id 1Mbfs0-0005dG-UY for dev@perl.apache.org; Thu, 13 Aug 2009 21:21:52 +0200 Date: Thu, 13 Aug 2009 21:21:52 +0200 From: Jan Pazdziora To: dev@perl.apache.org Subject: Proposal for CPAN module: Apache2::RequestRec::Time Message-ID: <20090813192152.GA21648@relay.adelton.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-Virus-Checked: Checked by ClamAV on apache.org 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 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-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org