Filename | /usr/local/share/perl/5.18.2/Plack/Response.pm |
Statements | Executed 5700075 statements in 14.9s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
100001 | 1 | 1 | 3.83s | 13.9s | finalize | Plack::Response::
300003 | 1 | 1 | 2.32s | 2.89s | __ANON__[:96] | Plack::Response::
500005 | 5 | 2 | 1.67s | 2.20s | headers | Plack::Response::
100001 | 1 | 1 | 1.34s | 3.42s | content_length | Plack::Response::
100001 | 1 | 1 | 1.24s | 1.67s | new | Plack::Response::
100001 | 1 | 1 | 1.00s | 1.14s | _body | Plack::Response::
100001 | 1 | 1 | 1.00s | 4.35s | header | Plack::Response::
100001 | 1 | 1 | 952ms | 1.51s | content_type | Plack::Response::
100001 | 1 | 1 | 831ms | 1.18s | _finalize_cookies | Plack::Response::
100001 | 1 | 1 | 741ms | 1.09s | content | Plack::Response::
600006 | 2 | 1 | 572ms | 572ms | CORE:subst (opcode) | Plack::Response::
100001 | 1 | 1 | 349ms | 349ms | cookies | Plack::Response::
1 | 1 | 1 | 641µs | 854µs | BEGIN@8 | Plack::Response::
1 | 1 | 1 | 18µs | 18µs | BEGIN@10 | Plack::Response::
1 | 1 | 1 | 10µs | 24µs | BEGIN@6 | Plack::Response::
1 | 1 | 1 | 10µs | 19µs | BEGIN@2 | Plack::Response::
1 | 1 | 1 | 7µs | 10µs | BEGIN@3 | Plack::Response::
1 | 1 | 1 | 3µs | 3µs | BEGIN@9 | Plack::Response::
1 | 1 | 1 | 3µs | 3µs | BEGIN@11 | Plack::Response::
1 | 1 | 1 | 3µs | 3µs | BEGIN@7 | Plack::Response::
0 | 0 | 0 | 0s | 0s | __ANON__[:109] | Plack::Response::
0 | 0 | 0 | 0s | 0s | code | Plack::Response::
0 | 0 | 0 | 0s | 0s | content_encoding | Plack::Response::
0 | 0 | 0 | 0s | 0s | location | Plack::Response::
0 | 0 | 0 | 0s | 0s | redirect | Plack::Response::
0 | 0 | 0 | 0s | 0s | to_app | Plack::Response::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Plack::Response; | ||||
2 | 2 | 19µs | 2 | 28µs | # spent 19µs (10+9) within Plack::Response::BEGIN@2 which was called:
# once (10µs+9µs) by PONAPI::Server::BEGIN@10 at line 2 # spent 19µs making 1 call to Plack::Response::BEGIN@2
# spent 9µs making 1 call to strict::import |
3 | 2 | 30µs | 2 | 13µs | # spent 10µs (7+3) within Plack::Response::BEGIN@3 which was called:
# once (7µs+3µs) by PONAPI::Server::BEGIN@10 at line 3 # spent 10µs making 1 call to Plack::Response::BEGIN@3
# spent 3µs making 1 call to warnings::import |
4 | 1 | 400ns | our $VERSION = '1.0037'; | ||
5 | |||||
6 | 2 | 20µs | 2 | 38µs | # spent 24µs (10+14) within Plack::Response::BEGIN@6 which was called:
# once (10µs+14µs) by PONAPI::Server::BEGIN@10 at line 6 # spent 24µs making 1 call to Plack::Response::BEGIN@6
# spent 14µs making 1 call to Plack::Util::Accessor::import |
7 | 2 | 16µs | 1 | 3µs | # spent 3µs within Plack::Response::BEGIN@7 which was called:
# once (3µs+0s) by PONAPI::Server::BEGIN@10 at line 7 # spent 3µs making 1 call to Plack::Response::BEGIN@7 |
8 | 2 | 77µs | 1 | 854µs | # spent 854µs (641+212) within Plack::Response::BEGIN@8 which was called:
# once (641µs+212µs) by PONAPI::Server::BEGIN@10 at line 8 # spent 854µs making 1 call to Plack::Response::BEGIN@8 |
9 | 2 | 44µs | 1 | 3µs | # spent 3µs within Plack::Response::BEGIN@9 which was called:
# once (3µs+0s) by PONAPI::Server::BEGIN@10 at line 9 # spent 3µs making 1 call to Plack::Response::BEGIN@9 |
10 | 2 | 27µs | 1 | 18µs | # spent 18µs within Plack::Response::BEGIN@10 which was called:
# once (18µs+0s) by PONAPI::Server::BEGIN@10 at line 10 # spent 18µs making 1 call to Plack::Response::BEGIN@10 |
11 | 2 | 583µs | 1 | 3µs | # spent 3µs within Plack::Response::BEGIN@11 which was called:
# once (3µs+0s) by PONAPI::Server::BEGIN@10 at line 11 # spent 3µs making 1 call to Plack::Response::BEGIN@11 |
12 | |||||
13 | sub code { shift->status(@_) } | ||||
14 | 100001 | 501ms | 100001 | 349ms | # spent 1.09s (741ms+349ms) within Plack::Response::content which was called 100001 times, avg 11µs/call:
# 100001 times (741ms+349ms) by PONAPI::Server::_response at line 368 of lib/PONAPI/Server.pm, avg 11µs/call # spent 349ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 3µs/call |
15 | |||||
16 | # spent 1.67s (1.24+434ms) within Plack::Response::new which was called 100001 times, avg 17µs/call:
# 100001 times (1.24s+434ms) by PONAPI::Server::_response at line 358 of lib/PONAPI/Server.pm, avg 17µs/call | ||||
17 | 100001 | 72.6ms | my($class, $rc, $headers, $content) = @_; | ||
18 | |||||
19 | 100001 | 131ms | my $self = bless {}, $class; | ||
20 | 100001 | 276ms | 100001 | 434ms | $self->status($rc) if defined $rc; # spent 434ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 4µs/call |
21 | 100001 | 43.9ms | $self->headers($headers) if defined $headers; | ||
22 | 100001 | 36.1ms | $self->body($content) if defined $content; | ||
23 | |||||
24 | 100001 | 453ms | $self; | ||
25 | } | ||||
26 | |||||
27 | # spent 2.20s (1.67+533ms) within Plack::Response::headers which was called 500005 times, avg 4µs/call:
# 100001 times (1.13s+533ms) by PONAPI::Server::_response at line 360 of lib/PONAPI/Server.pm, avg 17µs/call
# 100001 times (175ms+0s) by Plack::Response::header at line 53, avg 2µs/call
# 100001 times (140ms+0s) by Plack::Response::content_length at line 56, avg 1µs/call
# 100001 times (120ms+0s) by Plack::Response::finalize at line 89, avg 1µs/call
# 100001 times (105ms+0s) by Plack::Response::content_type at line 60, avg 1µs/call | ||||
28 | 500005 | 91.6ms | my $self = shift; | ||
29 | |||||
30 | 500005 | 155ms | if (@_) { | ||
31 | 100001 | 26.2ms | my $headers = shift; | ||
32 | 100001 | 136ms | if (ref $headers eq 'ARRAY') { | ||
33 | 100001 | 85.5ms | Carp::carp("Odd number of headers") if @$headers % 2 != 0; | ||
34 | 100001 | 294ms | 100001 | 533ms | $headers = HTTP::Headers::Fast->new(@$headers); # spent 533ms making 100001 calls to HTTP::Headers::Fast::new, avg 5µs/call |
35 | } elsif (ref $headers eq 'HASH') { | ||||
36 | $headers = HTTP::Headers::Fast->new(%$headers); | ||||
37 | } | ||||
38 | 100001 | 412ms | return $self->{headers} = $headers; | ||
39 | } else { | ||||
40 | 400004 | 1.61s | return $self->{headers} ||= HTTP::Headers::Fast->new(); | ||
41 | } | ||||
42 | } | ||||
43 | |||||
44 | # spent 349ms within Plack::Response::cookies which was called 100001 times, avg 3µs/call:
# 100001 times (349ms+0s) by Plack::Response::_finalize_cookies at line 127, avg 3µs/call | ||||
45 | 100001 | 42.7ms | my $self = shift; | ||
46 | 100001 | 59.0ms | if (@_) { | ||
47 | $self->{cookies} = shift; | ||||
48 | } else { | ||||
49 | 100001 | 565ms | return $self->{cookies} ||= +{ }; | ||
50 | } | ||||
51 | } | ||||
52 | |||||
53 | 100001 | 653ms | 200002 | 3.35s | # spent 4.35s (1.00+3.35) within Plack::Response::header which was called 100001 times, avg 43µs/call:
# 100001 times (1.00s+3.35s) by PONAPI::Server::_response at line 361 of lib/PONAPI/Server.pm, avg 43µs/call # spent 3.17s making 100001 calls to HTTP::Headers::Fast::header, avg 32µs/call
# spent 175ms making 100001 calls to Plack::Response::headers, avg 2µs/call |
54 | |||||
55 | # spent 3.42s (1.34+2.08) within Plack::Response::content_length which was called 100001 times, avg 34µs/call:
# 100001 times (1.34s+2.08s) by PONAPI::Server::_response at line 366 of lib/PONAPI/Server.pm, avg 34µs/call | ||||
56 | 100001 | 700ms | 200002 | 2.08s | shift->headers->content_length(@_); # spent 1.94s making 100001 calls to HTTP::Headers::Fast::__ANON__[HTTP/Headers/Fast.pm:561], avg 19µs/call
# spent 140ms making 100001 calls to Plack::Response::headers, avg 1µs/call |
57 | } | ||||
58 | |||||
59 | # spent 1.51s (952ms+555ms) within Plack::Response::content_type which was called 100001 times, avg 15µs/call:
# 100001 times (952ms+555ms) by PONAPI::Server::_response at line 367 of lib/PONAPI/Server.pm, avg 15µs/call | ||||
60 | 100001 | 669ms | 200002 | 555ms | shift->headers->content_type(@_); # spent 450ms making 100001 calls to HTTP::Headers::Fast::content_type, avg 5µs/call
# spent 105ms making 100001 calls to Plack::Response::headers, avg 1µs/call |
61 | } | ||||
62 | |||||
63 | sub content_encoding { | ||||
64 | shift->headers->content_encoding(@_); | ||||
65 | } | ||||
66 | |||||
67 | sub location { | ||||
68 | my $self = shift; | ||||
69 | return $self->headers->header('Location' => @_); | ||||
70 | } | ||||
71 | |||||
72 | sub redirect { | ||||
73 | my $self = shift; | ||||
74 | |||||
75 | if (@_) { | ||||
76 | my $url = shift; | ||||
77 | my $status = shift || 302; | ||||
78 | $self->location($url); | ||||
79 | $self->status($status); | ||||
80 | } | ||||
81 | |||||
82 | return $self->location; | ||||
83 | } | ||||
84 | |||||
85 | # spent 13.9s (3.83+10.0) within Plack::Response::finalize which was called 100001 times, avg 139µs/call:
# 100001 times (3.83s+10.0s) by PONAPI::Server::_response at line 371 of lib/PONAPI/Server.pm, avg 139µs/call | ||||
86 | 100001 | 39.3ms | my $self = shift; | ||
87 | 100001 | 120ms | 100001 | 145ms | Carp::croak "missing status" unless $self->status(); # spent 145ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 1µs/call |
88 | |||||
89 | 100001 | 125ms | 100001 | 120ms | my $headers = $self->headers; # spent 120ms making 100001 calls to Plack::Response::headers, avg 1µs/call |
90 | 100001 | 24.7ms | my @headers; | ||
91 | # spent 2.89s (2.32+572ms) within Plack::Response::__ANON__[/usr/local/share/perl/5.18.2/Plack/Response.pm:96] which was called 300003 times, avg 10µs/call:
# 300003 times (2.32s+572ms) by HTTP::Headers::Fast::scan at line 296 of HTTP/Headers/Fast.pm, avg 10µs/call | ||||
92 | 300003 | 175ms | my ($k,$v) = @_; | ||
93 | 300003 | 1.09s | 300003 | 193ms | $v =~ s/\015\012[\040|\011]+/chr(32)/ge; # replace LWS with a single SP # spent 193ms making 300003 calls to Plack::Response::CORE:subst, avg 644ns/call |
94 | 300003 | 1.17s | 300003 | 379ms | $v =~ s/\015|\012//g; # remove CR and LF since the char is invalid here # spent 379ms making 300003 calls to Plack::Response::CORE:subst, avg 1µs/call |
95 | 300003 | 1.64s | push @headers, $k, $v; | ||
96 | 100001 | 885ms | 100001 | 7.31s | }); # spent 7.31s making 100001 calls to HTTP::Headers::Fast::scan, avg 73µs/call |
97 | |||||
98 | 100001 | 266ms | 100001 | 1.18s | $self->_finalize_cookies(\@headers); # spent 1.18s making 100001 calls to Plack::Response::_finalize_cookies, avg 12µs/call |
99 | |||||
100 | return [ | ||||
101 | 100001 | 826ms | 200002 | 1.27s | $self->status, # spent 1.14s making 100001 calls to Plack::Response::_body, avg 11µs/call
# spent 135ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 1µs/call |
102 | \@headers, | ||||
103 | $self->_body, | ||||
104 | ]; | ||||
105 | } | ||||
106 | |||||
107 | sub to_app { | ||||
108 | my $self = shift; | ||||
109 | return sub { $self->finalize }; | ||||
110 | } | ||||
111 | |||||
112 | |||||
113 | # spent 1.14s (1.00+136ms) within Plack::Response::_body which was called 100001 times, avg 11µs/call:
# 100001 times (1.00s+136ms) by Plack::Response::finalize at line 101, avg 11µs/call | ||||
114 | 100001 | 37.6ms | my $self = shift; | ||
115 | 100001 | 162ms | 100001 | 136ms | my $body = $self->body; # spent 136ms making 100001 calls to Plack::Util::Accessor::__ANON__[Plack/Util/Accessor.pm:19], avg 1µs/call |
116 | 100001 | 37.9ms | $body = [] unless defined $body; | ||
117 | 100001 | 488ms | if (!ref $body or Scalar::Util::blessed($body) && overload::Method($body, q("")) && !$body->can('getline')) { | ||
118 | return [ $body ]; | ||||
119 | } else { | ||||
120 | return $body; | ||||
121 | } | ||||
122 | } | ||||
123 | |||||
124 | # spent 1.18s (831ms+349ms) within Plack::Response::_finalize_cookies which was called 100001 times, avg 12µs/call:
# 100001 times (831ms+349ms) by Plack::Response::finalize at line 98, avg 12µs/call | ||||
125 | 100001 | 43.0ms | my($self, $headers) = @_; | ||
126 | |||||
127 | 100001 | 712ms | 100001 | 349ms | foreach my $name ( keys %{ $self->cookies } ) { # spent 349ms making 100001 calls to Plack::Response::cookies, avg 3µs/call |
128 | my $val = $self->cookies->{$name}; | ||||
129 | |||||
130 | my $cookie = Cookie::Baker::bake_cookie( $name, $val ); | ||||
131 | push @$headers, 'Set-Cookie' => $cookie; | ||||
132 | } | ||||
133 | } | ||||
134 | |||||
135 | 1 | 2µs | 1; | ||
136 | __END__ | ||||
# spent 572ms within Plack::Response::CORE:subst which was called 600006 times, avg 954ns/call:
# 300003 times (379ms+0s) by Plack::Response::__ANON__[/usr/local/share/perl/5.18.2/Plack/Response.pm:96] at line 94, avg 1µs/call
# 300003 times (193ms+0s) by Plack::Response::__ANON__[/usr/local/share/perl/5.18.2/Plack/Response.pm:96] at line 93, avg 644ns/call |