Profile of Plack/Middleware/AccessLog.pm

← 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
Statements | Executed 1100027 statements in 4.90s

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
100001 | 1 | 1 | 5.55s | 931s | Plack::Middleware::AccessLog::::callPlack::Middleware::AccessLog::call
100001 | 1 | 1 | 1.62s | 11.4s | Plack::Middleware::AccessLog::::log_linePlack::Middleware::AccessLog::log_line
1 | 1 | 1 | 1.29ms | 5.36ms | Plack::Middleware::AccessLog::::BEGIN@6Plack::Middleware::AccessLog::BEGIN@6
1 | 1 | 1 | 12µs | 26µs | Plack::Middleware::AccessLog::::BEGIN@2Plack::Middleware::AccessLog::BEGIN@2
1 | 1 | 1 | 11µs | 407µs | Plack::Middleware::AccessLog::::prepare_appPlack::Middleware::AccessLog::prepare_app
1 | 1 | 1 | 8µs | 30µs | Plack::Middleware::AccessLog::::BEGIN@4Plack::Middleware::AccessLog::BEGIN@4
1 | 1 | 1 | 7µs | 13µs | Plack::Middleware::AccessLog::::BEGIN@3Plack::Middleware::AccessLog::BEGIN@3
1 | 1 | 1 | 6µs | 30µs | Plack::Middleware::AccessLog::::BEGIN@5Plack::Middleware::AccessLog::BEGIN@5
0 | 0 | 0 | 0s | 0s | Plack::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Plack::Middleware::AccessLog;
2 | 2 | 21µs | 2 | 40µ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
3 | 2 | 21µs | 2 | 20µ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
4 | 2 | 24µs | 2 | 51µ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
5 | 2 | 20µs | 2 | 54µ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
6 | 2 | 717µs | 1 | 5.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 |  |  |  |  |
8 | 1 | 1µs |  |  | my %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 {
14 | 1 | 100ns |  |  | my $self = shift;
15 | 1 | 2µs | 1 | 44µs | my $fmt = $self->format || "combined"; # spent 44µs making 1 call to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19]
16 | 1 | 2µs |  |  | $fmt = $formats{$fmt} if exists $formats{$fmt};
17 | 1 | 6µs | 2 | 352µ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 {
21 | 100001 | 63.7ms |  |  | my $self = shift;
22 | 100001 | 67.0ms |  |  | my($env) = @_;
23 |  |  |  |  |
24 | 100001 | 432ms | 200002 | 909s | 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 |  |  |  |  |
26 | 100001 | 165ms |  |  | if ( ref($res) && ref($res) eq 'ARRAY' ) {
27 | 100001 | 333ms | 100001 | 700ms | my $content_length = Plack::Util::content_length($res->[2]); # spent 700ms making 100001 calls to Plack::Util::content_length, avg 7µs/call
28 | 100001 | 677ms | 100001 | 11.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
29 | 100001 | 452ms | 100001 | 228ms | 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 {
33 | 100001 | 723ms | 100001 | 3.81s | $env->{'psgi.errors'}->print($log_line); # spent 3.81s making 100001 calls to IO::Handle::print, avg 38µs/call
34 |  |  |  |  | }
35 | 100001 | 813ms |  |  | 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 {
52 | 100001 | 81.7ms |  |  | my($self, $status, $headers, $env, $opts) = @_;
53 |  |  |  |  |
54 | 100001 | 1.10s | 200002 | 9.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 |  |  |  |  |
62 | 1 | 3µs |  |  | 1;
63 |  |  |  |  |
64 |  |  |  |  | __END__