| Filename | /usr/local/share/perl/5.18.2/Plack/Loader.pm |
| Statements | Executed 31 statements in 544µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 27µs | 24.7ms | Plack::Loader::load |
| 1 | 1 | 1 | 23µs | 24.7ms | Plack::Loader::auto |
| 1 | 1 | 1 | 10µs | 23µs | Plack::Loader::BEGIN@2 |
| 1 | 1 | 1 | 8µs | 44µs | Plack::Loader::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 8µs | Plack::Loader::guess |
| 1 | 1 | 1 | 6µs | 543µs | Plack::Loader::preload_app |
| 1 | 1 | 1 | 4µs | 4µs | Plack::Loader::BEGIN@4 |
| 1 | 1 | 1 | 3µs | 3µs | Plack::Loader::BEGIN@3 |
| 1 | 1 | 1 | 3µs | 3µs | Plack::Loader::new |
| 1 | 1 | 1 | 600ns | 600ns | Plack::Loader::env |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::__ANON__[:24] |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::__ANON__[:31] |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::__ANON__[:42] |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::__ANON__[:44] |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::run |
| 0 | 0 | 0 | 0s | 0s | Plack::Loader::watch |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Plack::Loader; | ||||
| 2 | 2 | 22µs | 2 | 36µ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 # spent 23µs making 1 call to Plack::Loader::BEGIN@2
# spent 13µs making 1 call to strict::import |
| 3 | 2 | 17µs | 1 | 3µs | # spent 3µs within Plack::Loader::BEGIN@3 which was called:
# once (3µs+0s) by Plack::Util::load_class at line 3 # spent 3µs making 1 call to Plack::Loader::BEGIN@3 |
| 4 | 2 | 17µs | 1 | 4µs | # spent 4µs within Plack::Loader::BEGIN@4 which was called:
# once (4µs+0s) by Plack::Util::load_class at line 4 # spent 4µs making 1 call to Plack::Loader::BEGIN@4 |
| 5 | 2 | 406µs | 2 | 81µ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 # 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 | ||||
| 8 | 1 | 600ns | my $class = shift; | ||
| 9 | 1 | 5µs | bless {}, $class; | ||
| 10 | } | ||||
| 11 | |||||
| 12 | sub 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 | ||||
| 17 | 1 | 2µs | my($class, @args) = @_; | ||
| 18 | |||||
| 19 | 1 | 1µs | 1 | 8µ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 { | ||||
| 23 | 1 | 3µs | 1 | 24.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); | ||||
| 31 | 1 | 11µs | 2 | 24.7ms | }; # spent 24.7ms making 1 call to Try::Tiny::try
# spent 4µs making 1 call to Try::Tiny::catch |
| 32 | |||||
| 33 | 1 | 5µ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 | ||||
| 37 | 1 | 1µs | my($class, $server, @args) = @_; | ||
| 38 | |||||
| 39 | 1 | 100ns | my($server_class, $error); | ||
| 40 | try { | ||||
| 41 | 1 | 5µs | 1 | 24.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 ||= $_; | ||||
| 44 | 1 | 10µs | 2 | 2µ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 | |||||
| 46 | 1 | 10µs | 1 | 6µ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 | ||||
| 54 | 1 | 400ns | my($self, $builder) = @_; | ||
| 55 | 1 | 9µs | 1 | 536µ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 | ||||
| 59 | 1 | 200ns | my $class = shift; | ||
| 60 | |||||
| 61 | 1 | 900ns | 1 | 600ns | my $env = $class->env; # spent 600ns making 1 call to Plack::Loader::env |
| 62 | |||||
| 63 | 1 | 400ns | return $env->{PLACK_SERVER} if $env->{PLACK_SERVER}; | ||
| 64 | |||||
| 65 | 1 | 2µ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 { | ||||
| 76 | 1 | 4µs | return "Standalone"; | ||
| 77 | } | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | 1 | 3µs | # spent 600ns within Plack::Loader::env which was called:
# once (600ns+0s) by Plack::Loader::guess at line 61 | ||
| 81 | |||||
| 82 | sub run { | ||||
| 83 | 1 | 500ns | my($self, $server, $builder) = @_; | ||
| 84 | 1 | 3µs | $server->run($self->{app}); | ||
| 85 | } | ||||
| 86 | |||||
| 87 | 1 | 3µs | 1; | ||
| 88 | |||||
| 89 | __END__ |