← 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/Middleware/AccessLog.pm
StatementsExecuted 1100027 statements in 4.90s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
100001115.55s931sPlack::Middleware::AccessLog::::callPlack::Middleware::AccessLog::call
100001111.62s11.4sPlack::Middleware::AccessLog::::log_linePlack::Middleware::AccessLog::log_line
1111.29ms5.36msPlack::Middleware::AccessLog::::BEGIN@6Plack::Middleware::AccessLog::BEGIN@6
11112µs26µsPlack::Middleware::AccessLog::::BEGIN@2Plack::Middleware::AccessLog::BEGIN@2
11111µs407µsPlack::Middleware::AccessLog::::prepare_appPlack::Middleware::AccessLog::prepare_app
1118µs30µsPlack::Middleware::AccessLog::::BEGIN@4Plack::Middleware::AccessLog::BEGIN@4
1117µs13µsPlack::Middleware::AccessLog::::BEGIN@3Plack::Middleware::AccessLog::BEGIN@3
1116µs30µsPlack::Middleware::AccessLog::::BEGIN@5Plack::Middleware::AccessLog::BEGIN@5
0000s0sPlack::Middleware::AccessLog::::__ANON__[:48]Plack::Middleware::AccessLog::__ANON__[:48]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Plack::Middleware::AccessLog;
2221µs240µs
# spent 26µs (12+14) within Plack::Middleware::AccessLog::BEGIN@2 which was called: # once (12µs+14µs) by Plack::Util::load_class at line 2
use strict;
# spent 26µs making 1 call to Plack::Middleware::AccessLog::BEGIN@2 # spent 14µs making 1 call to strict::import
3221µs220µs
# spent 13µs (7+6) within Plack::Middleware::AccessLog::BEGIN@3 which was called: # once (7µs+6µs) by Plack::Util::load_class at line 3
use warnings;
# spent 13µs making 1 call to Plack::Middleware::AccessLog::BEGIN@3 # spent 6µs making 1 call to warnings::import
4224µs251µs
# spent 30µs (8+22) within Plack::Middleware::AccessLog::BEGIN@4 which was called: # once (8µs+22µs) by Plack::Util::load_class at line 4
use parent qw( Plack::Middleware );
# spent 30µs making 1 call to Plack::Middleware::AccessLog::BEGIN@4 # spent 22µs making 1 call to parent::import
5220µs254µs
# spent 30µs (6+24) within Plack::Middleware::AccessLog::BEGIN@5 which was called: # once (6µs+24µs) by Plack::Util::load_class at line 5
use Plack::Util::Accessor qw( logger format compiled_format);
# spent 30µs making 1 call to Plack::Middleware::AccessLog::BEGIN@5 # spent 24µs making 1 call to Plack::Util::Accessor::import
62717µs15.36ms
# spent 5.36ms (1.29+4.07) within Plack::Middleware::AccessLog::BEGIN@6 which was called: # once (1.29ms+4.07ms) by Plack::Util::load_class at line 6
use Apache::LogFormat::Compiler;
# spent 5.36ms making 1 call to Plack::Middleware::AccessLog::BEGIN@6
7
811µsmy %formats = (
9 common => '%h %l %u %t "%r" %>s %b',
10 combined => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"',
11);
12
13
# spent 407µs (11+395) within Plack::Middleware::AccessLog::prepare_app which was called: # once (11µs+395µs) by Plack::Component::to_app at line 49 of Plack/Component.pm
sub prepare_app {
141100ns my $self = shift;
1512µs144µs my $fmt = $self->format || "combined";
1612µs $fmt = $formats{$fmt} if exists $formats{$fmt};
1716µs2352µs $self->compiled_format(Apache::LogFormat::Compiler->new($fmt));
# spent 348µs making 1 call to Apache::LogFormat::Compiler::new # spent 4µs making 1 call to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19]
18}
19
20
# spent 931s (5.55+925) within Plack::Middleware::AccessLog::call which was called 100001 times, avg 9.31ms/call: # 100001 times (5.55s+925s) by Plack::Component::__ANON__[/usr/local/share/perl/5.18.2/Plack/Component.pm:50] at line 50 of Plack/Component.pm, avg 9.31ms/call
sub call {
2110000163.7ms my $self = shift;
2210000167.0ms my($env) = @_;
23
24100001432ms200002909s my $res = $self->app->($env);
# spent 909s making 100001 calls to Plack::Component::__ANON__[Plack/Component.pm:50], avg 9.09ms/call # spent 206ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 2µs/call
25
26100001165ms if ( ref($res) && ref($res) eq 'ARRAY' ) {
27100001333ms100001700ms my $content_length = Plack::Util::content_length($res->[2]);
# spent 700ms making 100001 calls to Plack::Util::content_length, avg 7µs/call
28100001677ms10000111.4s my $log_line = $self->log_line($res->[0], $res->[1], $env, { content_length => $content_length });
# spent 11.4s making 100001 calls to Plack::Middleware::AccessLog::log_line, avg 114µs/call
29100001452ms100001228ms if ( my $logger = $self->logger ) {
# spent 228ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 2µs/call
30 $logger->($log_line);
31 }
32 else {
33100001723ms1000013.81s $env->{'psgi.errors'}->print($log_line);
# spent 3.81s making 100001 calls to IO::Handle::print, avg 38µs/call
34 }
35100001813ms return $res;
36 }
37
38 return $self->response_cb($res, sub {
39 my $res = shift;
40 my $content_length = Plack::Util::content_length($res->[2]);
41 my $log_line = $self->log_line($res->[0], $res->[1], $env, { content_length => $content_length });
42 if ( my $logger = $self->logger ) {
43 $logger->($log_line);
44 }
45 else {
46 $env->{'psgi.errors'}->print($log_line);
47 }
48 });
49}
50
51
# spent 11.4s (1.62+9.79) within Plack::Middleware::AccessLog::log_line which was called 100001 times, avg 114µs/call: # 100001 times (1.62s+9.79s) by Plack::Middleware::AccessLog::call at line 28, avg 114µs/call
sub log_line {
5210000181.7ms my($self, $status, $headers, $env, $opts) = @_;
53
541000011.10s2000029.79s $self->compiled_format->log_line(
# spent 9.48s making 100001 calls to Apache::LogFormat::Compiler::log_line, avg 95µs/call # spent 310ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 3µs/call
55 $env,
56 [$status,$headers],
57 $opts->{content_length},
58 $opts->{time}
59 );
60}
61
6213µs1;
63
64__END__