Amon2 documentation

Profiling

Profiling

Devel::NYTProf

You can profile your Amon2 application. My recommend profiling tool is Devel::NYTProf. You can install it as following one liner:

% curl -LO http://cpanmin.us/ | perl - Devel::NYTProf

And you can profiling your application with following script.

use strict;
use warnings;
use utf8;

use MyApp::Web;
use Devel::NYTProf;
use HTTP::Message::PSGI;
use HTTP::Request;
use HTTP::Response;

my $req = HTTP::Request->new('GET', 'http://localhost/');
my $env = $req->to_psgi();

my $app = MyApp::Web->to_app();
print res_from_psgi($app->($env))->as_string;

my $n = shift || 1000;
for (1..$n) {
    $app->($env);
}