Plack::Middleware::TimeStats - Plack Timing Statistics Middleware
use Plack::Builder; builder { enable "TimeStats"; sub { my $env = shift; $env->{"psgix.timestats"}->profile("foo"); [ 200, [], ["OK"] ] }; };
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% | '--------+-----------+---------'
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-
profile
$env->{"psgix.timestats"}->profile("foo");
Check more methods in document of Devel::TimeStats.
This module has few options.
Default is to output a stats result to STDERR.
The key of psgix extension. Default is psgix.timestats. You can NOT specify prefix psgix.. It is required.
psgix.timestats
psgix.
enable "TimeStats"; # 'psgix.timestats' enable "TimeStats", psgix => 'mystats'; # 'psgix.mystats'
option passes through to Devel::TimeStats's constructor.
option
Default is PATH_INFO. You can set this option as code reference.
PATH_INFO
Plack::Middleware::TimeStats is hosted on github <http://github.com/bayashi/Plack-Middleware-TimeStats>
Dai Okabayashi <bayashi@cpan.org>
Devel::TimeStats
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Plack::Middleware::TimeStats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::TimeStats
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::TimeStats
For more information on module installation, please visit the detailed CPAN module installation guide.