← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/usr/local/share/perl/5.18.2/Plack/Loader.pm
StatementsExecuted 31 statements in 544µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11127µs24.7msPlack::Loader::::loadPlack::Loader::load
11123µs24.7msPlack::Loader::::autoPlack::Loader::auto
11110µs23µsPlack::Loader::::BEGIN@2Plack::Loader::BEGIN@2
1118µs44µsPlack::Loader::::BEGIN@5Plack::Loader::BEGIN@5
1117µs8µsPlack::Loader::::guessPlack::Loader::guess
1116µs543µsPlack::Loader::::preload_appPlack::Loader::preload_app
1114µs4µsPlack::Loader::::BEGIN@4Plack::Loader::BEGIN@4
1113µs3µsPlack::Loader::::BEGIN@3Plack::Loader::BEGIN@3
1113µs3µsPlack::Loader::::newPlack::Loader::new
111600ns600nsPlack::Loader::::envPlack::Loader::env
0000s0sPlack::Loader::::__ANON__[:24]Plack::Loader::__ANON__[:24]
0000s0sPlack::Loader::::__ANON__[:31]Plack::Loader::__ANON__[:31]
0000s0sPlack::Loader::::__ANON__[:42]Plack::Loader::__ANON__[:42]
0000s0sPlack::Loader::::__ANON__[:44]Plack::Loader::__ANON__[:44]
0000s0sPlack::Loader::::runPlack::Loader::run
0000s0sPlack::Loader::::watchPlack::Loader::watch
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Plack::Loader;
2222µs236µs
# spent 23µs (10+13) within Plack::Loader::BEGIN@2 which was called: # once (10µs+13µs) by Plack::Util::load_class at line 2
use strict;
# spent 23µs making 1 call to Plack::Loader::BEGIN@2 # spent 13µs making 1 call to strict::import
3217µs13µs
# spent 3µs within Plack::Loader::BEGIN@3 which was called: # once (3µs+0s) by Plack::Util::load_class at line 3
use Carp ();
# spent 3µs making 1 call to Plack::Loader::BEGIN@3
4217µs14µs
# spent 4µs within Plack::Loader::BEGIN@4 which was called: # once (4µs+0s) by Plack::Util::load_class at line 4
use Plack::Util;
# spent 4µs making 1 call to Plack::Loader::BEGIN@4
52406µs281µs
# spent 44µs (8+37) within Plack::Loader::BEGIN@5 which was called: # once (8µs+37µs) by Plack::Util::load_class at line 5
use Try::Tiny;
# spent 44µs making 1 call to Plack::Loader::BEGIN@5 # spent 37µs making 1 call to Exporter::import
6
7
# spent 3µs within Plack::Loader::new which was called: # once (3µs+0s) by Plack::Runner::loader at line 220 of Plack/Runner.pm
sub new {
81600ns my $class = shift;
915µs bless {}, $class;
10}
11
12sub watch {
13 # do nothing. Override in subclass
14}
15
16
# spent 24.7ms (23µs+24.7) within Plack::Loader::auto which was called: # once (23µs+24.7ms) by Plack::Runner::load_server at line 229 of Plack/Runner.pm
sub auto {
1712µs my($class, @args) = @_;
18
1911µs18µs my $backend = $class->guess
# spent 8µs making 1 call to Plack::Loader::guess
20 or Carp::croak("Couldn't auto-guess server server implementation. Set it with PLACK_SERVER");
21
22 my $server = try {
2313µs124.7ms $class->load($backend, @args);
# spent 24.7ms making 1 call to Plack::Loader::load
24 } catch {
25 if (($ENV{PLACK_ENV}||'') eq 'development' or !/^Can't locate /) {
26 warn "Autoloading '$backend' backend failed. Falling back to the Standalone. ",
27 "(You might need to install Plack::Handler::$backend from CPAN. Caught error was: $_)\n"
28 if $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development';
29 }
30 $class->load('Standalone' => @args);
31111µs224.7ms };
# spent 24.7ms making 1 call to Try::Tiny::try # spent 4µs making 1 call to Try::Tiny::catch
32
3315µs return $server;
34}
35
36
# spent 24.7ms (27µs+24.6) within Plack::Loader::load which was called: # once (27µs+24.6ms) by Plack::Loader::try {...} at line 23
sub load {
3711µs my($class, $server, @args) = @_;
38
391100ns my($server_class, $error);
40 try {
4115µs124.6ms $server_class = Plack::Util::load_class($server, 'Plack::Handler');
# spent 24.6ms making 1 call to Plack::Util::load_class
42 } catch {
43 $error ||= $_;
44110µs22µs };
# spent 2µs making 1 call to Try::Tiny::catch # spent 24.6ms making 1 call to Try::Tiny::try, recursion: max depth 1, sum of overlapping time 24.6ms
45
46110µs16µs if ($server_class) {
# spent 6µs making 1 call to Plack::Handler::HTTP::Server::PSGI::new
47 $server_class->new(@args);
48 } else {
49 die $error;
50 }
51}
52
53
# spent 543µs (6+536) within Plack::Loader::preload_app which was called: # once (6µs+536µs) by Plack::Runner::run at line 274 of Plack/Runner.pm
sub preload_app {
541400ns my($self, $builder) = @_;
5519µs1536µs $self->{app} = $builder->();
# spent 536µs making 1 call to Plack::Runner::__ANON__[Plack/Runner.pm:24]
56}
57
58
# spent 8µs (7+600ns) within Plack::Loader::guess which was called: # once (7µs+600ns) by Plack::Loader::auto at line 19
sub guess {
591200ns my $class = shift;
60
611900ns1600ns my $env = $class->env;
# spent 600ns making 1 call to Plack::Loader::env
62
631400ns return $env->{PLACK_SERVER} if $env->{PLACK_SERVER};
64
6512µs if ($env->{PHP_FCGI_CHILDREN} || $env->{FCGI_ROLE} || $env->{FCGI_SOCKET_PATH}) {
66 return "FCGI";
67 } elsif ($env->{GATEWAY_INTERFACE}) {
68 return "CGI";
69 } elsif (exists $INC{"Coro.pm"}) {
70 return "Corona";
71 } elsif (exists $INC{"AnyEvent.pm"}) {
72 return "Twiggy";
73 } elsif (exists $INC{"POE.pm"}) {
74 return "POE";
75 } else {
7614µs return "Standalone";
77 }
78}
79
8013µs
# spent 600ns within Plack::Loader::env which was called: # once (600ns+0s) by Plack::Loader::guess at line 61
sub env { \%ENV }
81
82sub run {
831500ns my($self, $server, $builder) = @_;
8413µs $server->run($self->{app});
85}
86
8713µs1;
88
89__END__