<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Apache::Timeit;

use strict;
use Benchmark;
use Apache::Constants ':common';

my $begin;

sub handler {
    my $r = shift;

    $begin = Benchmark-&gt;new; 
    $r-&gt;push_handlers(PerlLogHandler =&gt; \&amp;log);

    return OK;
}

sub log {
    my $r = shift;

    my $end = Benchmark-&gt;new; 

    warn sprintf "timing request for %s: %s\n",
    $r-&gt;uri, timestr(timediff($end,$begin));

    return OK;
}

1;

__END__

=head1 NAME

Apache::Timeit - Benchmark PerlHandlers

=head1 SYNOPSIS

 PerlFixupHandler Apache::Timeit

=head1 DESCRIPTION

Use B&lt;PerlFixupHandler&gt; and B&lt;PerlLogHandler&gt; and the 
B&lt;Benchmark&gt; module to time execution of B&lt;PerlHandler&gt; code.

=head1 SEE ALSO

mod_perl(3), Apache(3), Benchmark(3)

=head1 AUTHOR

Doug MacEachern



</pre></body></html>