The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use Plack::Builder;

my $app = sub {
    my $env = shift;
    return [ '200', [ 'Content-Type' => 'text/plain' ], [ "Hello World" ] ];
};

builder {
    # you should execute 'mkdir /tmp/profile' before invoking this PSGI app;
    enable_if { 1 } 'Profiler::NYTProf',
        enable_profile       => sub { 1 },
        env_nytprof          => 'start=no:addpid=0:file=/tmp/profile/nytprof.out',
        profiling_result_dir => sub { '/tmp/profile' },
        enable_reporting     => 1;
    $app;
};

=pod

    check the report.

    $ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new({root => "./report"})->to_app'

=cut