ANNOUNCE: Apache2::RequestRec::Time 1.0

ANNOUNCE: Apache2::RequestRec::Time 1.0

am 10.09.2009 20:42:50 von Jan Pazdziora

The uploaded file

Apache2-RequestRec-Time-1.0.tar.gz

has entered CPAN as

file: $CPAN/authors/id/J/JA/JANPAZ/Apache2-RequestRec-Time-1.0.tar .gz
size: 3370 bytes
md5: 2c08dc68bfeeae47c8df2eae87f3b22d

README
As of mod_perl 2.0.4, it is possible to get request duration
information by substracting current time from $r->request_time().
However, that information is in seconds, so it's not possible to get
the equivalent of Custom Log Format %D -- the time taken to serve
the request, in microseconds.

This module adds $r->request_duration_microseconds() method,
and a couple of utility methods.

NAME
Apache2::RequestRec::Time - Bring microseconds to Apache2::RequestRec

SYNOPSIS
use Apache2::RequestRec::Time ();
# have Apache2::RequestRec object $r
my $duration = $r->request_duration_microseconds();

DESCRIPTION
The Apache2::RequestRec::Time extends the Apache2::RequestRec
functionality with method request_duration_microseconds(). That makes
it possible to retrieve from Perl information equivalent to Custom Log
Format’s %D: the time taken to serve the request, in microseconds.

API
request_duration_microseconds($r)
Parameters: $r: Apache2::RequestRec object

Returns: time taken to serve the request, in microseconds.
Actually, it’s time since $r->request_time(). It is equivalent to
%D in Custom Log Formats.

request_duration($r)
Parameters: $r: Apache2::RequestRec object

Returns: time taken to serve the request, in seconds. Equivalent to
%T in Custom Log Formats.

request_time_microseconds($r)
Parameters: $r: Apache2::RequestRec object

Returns: time the request was received, in microseconds since
epoch. This is microsecond-ish variant of $r->request_time().

Enjoy. Comments welcome.

--
Jan Pazdziora