NAME
Plack::Middleware::TimeStats - Plack Timing Statistics Middleware
SYNOPSIS
use Plack::Builder;
builder {
    enable "TimeStats";
    sub {
        my $env = shift;
        $env->{"psgix.timestats"}->profile("foo");
        [ 200, [], ["OK"] ]
    };
};
DESCRIPTION
Plack::Middleware::TimeStats is the Plack middleware for getting a timing statistics.
This module provides the default, put a timing statistics to STDERR at the end of request, like below.
.--------+-----------+---------.
| Action | Time      | %       |
+--------+-----------+---------+
| /      | 0.000574s | 100.00% |
|  - foo | 0.000452s | 78.75%  |
'--------+-----------+---------'
HOW TO GET A STATS IN YOUR APP
You can get a timing profile by $env->{"psgix.timestats"}. It's a Devel::TimeStats object. So you call profile method with an action string, then stack a timing stats.
$env->{"psgix.timestats"}->profile("foo");
Check more methods in document of Devel::TimeStats.
MIDDLEWARE OPTIONS
This module has few options.
callback : code reference
Default is to output a stats result to STDERR.
psgix : string
The key of psgix extension. Default is psgix.timestats. You can NOT specify prefix psgix.. It is required.
enable "TimeStats";                     # 'psgix.timestats'
enable "TimeStats", psgix => 'mystats'; # 'psgix.mystats'
option : hash reference
option passes through to Devel::TimeStats's constructor.
action : code reference
Default is PATH_INFO. You can set this option as code reference.
METHODS
- call
 - prepare_app
 
REPOSITORY
Plack::Middleware::TimeStats is hosted on github http://github.com/bayashi/Plack-Middleware-TimeStats
AUTHOR
Dai Okabayashi <bayashi@cpan.org>
SEE ALSO
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.