Filename | /usr/local/share/perl/5.18.2/HTTP/Headers/ActionPack/MediaTypeList.pm |
Statements | Executed 1400028 statements in 7.22s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
100001 | 1 | 1 | 2.48s | 22.4s | add_header_value | HTTP::Headers::ActionPack::MediaTypeList::
100001 | 1 | 1 | 2.45s | 2.73s | iterable | HTTP::Headers::ActionPack::MediaTypeList::
100001 | 1 | 1 | 1.13s | 14.6s | add | HTTP::Headers::ActionPack::MediaTypeList::
100001 | 1 | 1 | 884ms | 1.20s | canonicalize_choice | HTTP::Headers::ActionPack::MediaTypeList::
100001 | 1 | 1 | 429ms | 429ms | BUILD | HTTP::Headers::ActionPack::MediaTypeList::
100001 | 1 | 1 | 112ms | 112ms | CORE:sort (opcode) | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 1.15ms | 18.5ms | BEGIN@15 | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 27µs | 27µs | BEGIN@2 | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 21µs | 86µs | BEGIN@10 | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 18µs | 34µs | BEGIN@11 | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 14µs | 2.60ms | BEGIN@17 | HTTP::Headers::ActionPack::MediaTypeList::
1 | 1 | 1 | 14µs | 84µs | BEGIN@13 | HTTP::Headers::ActionPack::MediaTypeList::
0 | 0 | 0 | 0s | 0s | as_string | HTTP::Headers::ActionPack::MediaTypeList::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package HTTP::Headers::ActionPack::MediaTypeList; | ||||
2 | # spent 27µs within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@2 which was called:
# once (27µs+0s) by Module::Runtime::require_module at line 4 | ||||
3 | 1 | 18µs | $HTTP::Headers::ActionPack::MediaTypeList::AUTHORITY = 'cpan:STEVAN'; | ||
4 | 1 | 59µs | 1 | 27µs | } # spent 27µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@2 |
5 | { | ||||
6 | 2 | 2µs | $HTTP::Headers::ActionPack::MediaTypeList::VERSION = '0.09'; | ||
7 | } | ||||
8 | # ABSTRACT: A Priority List customized for Media Types | ||||
9 | |||||
10 | 2 | 50µs | 2 | 151µs | # spent 86µs (21+65) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@10 which was called:
# once (21µs+65µs) by Module::Runtime::require_module at line 10 # spent 86µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@10
# spent 65µs making 1 call to strict::import |
11 | 2 | 45µs | 2 | 49µs | # spent 34µs (18+15) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@11 which was called:
# once (18µs+15µs) by Module::Runtime::require_module at line 11 # spent 34µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@11
# spent 15µs making 1 call to warnings::import |
12 | |||||
13 | 2 | 37µs | 2 | 154µs | # spent 84µs (14+70) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@13 which was called:
# once (14µs+70µs) by Module::Runtime::require_module at line 13 # spent 84µs making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@13
# spent 70µs making 1 call to Exporter::import |
14 | |||||
15 | 2 | 476µs | 1 | 18.5ms | # spent 18.5ms (1.15+17.4) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@15 which was called:
# once (1.15ms+17.4ms) by Module::Runtime::require_module at line 15 # spent 18.5ms making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@15 |
16 | |||||
17 | 2 | 509µs | 2 | 5.19ms | # spent 2.60ms (14µs+2.59) within HTTP::Headers::ActionPack::MediaTypeList::BEGIN@17 which was called:
# once (14µs+2.59ms) by Module::Runtime::require_module at line 17 # spent 2.60ms making 1 call to HTTP::Headers::ActionPack::MediaTypeList::BEGIN@17
# spent 2.59ms making 1 call to parent::import |
18 | |||||
19 | # spent 429ms within HTTP::Headers::ActionPack::MediaTypeList::BUILD which was called 100001 times, avg 4µs/call:
# 100001 times (429ms+0s) by HTTP::Headers::ActionPack::Core::Base::new at line 18 of HTTP/Headers/ActionPack/Core/Base.pm, avg 4µs/call | ||||
20 | 100001 | 80.6ms | my ($self, @items) = @_; | ||
21 | 100001 | 756ms | foreach my $item ( @items ) { | ||
22 | $self->add( ref $item eq 'ARRAY' ? @$item : $item ) | ||||
23 | } | ||||
24 | } | ||||
25 | |||||
26 | # spent 14.6s (1.13+13.5) within HTTP::Headers::ActionPack::MediaTypeList::add which was called 100001 times, avg 146µs/call:
# 100001 times (1.13s+13.5s) by HTTP::Headers::ActionPack::MediaTypeList::add_header_value at line 36, avg 146µs/call | ||||
27 | 100001 | 47.8ms | my $self = shift; | ||
28 | 100001 | 164ms | my ($q, $mt) = scalar @_ == 1 ? ((exists $_[0]->params->{'q'} ?$_[0]->params->{'q'} : 1.0), $_[0]) : @_; | ||
29 | 100001 | 825ms | 100001 | 13.5s | $self->SUPER::add( $q, $mt ); # spent 13.5s making 100001 calls to HTTP::Headers::ActionPack::PriorityList::add, avg 135µs/call |
30 | } | ||||
31 | |||||
32 | # spent 22.4s (2.48+19.9) within HTTP::Headers::ActionPack::MediaTypeList::add_header_value which was called 100001 times, avg 224µs/call:
# 100001 times (2.48s+19.9s) by HTTP::Headers::ActionPack::PriorityList::new_from_string at line 36 of HTTP/Headers/ActionPack/PriorityList.pm, avg 224µs/call | ||||
33 | 100001 | 52.6ms | my $self = shift; | ||
34 | 100001 | 566ms | 100001 | 5.04s | my $mt = HTTP::Headers::ActionPack::MediaType->new( @{ $_[0] } ); # spent 5.04s making 100001 calls to HTTP::Headers::ActionPack::Core::Base::new, avg 50µs/call |
35 | 100001 | 299ms | 100001 | 280ms | my $q = $mt->params->{'q'} || 1.0; # spent 280ms making 100001 calls to HTTP::Headers::ActionPack::Core::BaseHeaderWithParams::params, avg 3µs/call |
36 | 100001 | 777ms | 100001 | 14.6s | $self->add( $q, $mt ); # spent 14.6s making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::add, avg 146µs/call |
37 | } | ||||
38 | |||||
39 | sub as_string { | ||||
40 | my $self = shift; | ||||
41 | join ', ' => map { $_->[1]->as_string } $self->iterable; | ||||
42 | } | ||||
43 | |||||
44 | # spent 2.73s (2.45+280ms) within HTTP::Headers::ActionPack::MediaTypeList::iterable which was called 100001 times, avg 27µs/call:
# 100001 times (2.45s+280ms) by PONAPI::Server::_ponapi_check_headers at line 222 of lib/PONAPI/Server.pm, avg 27µs/call | ||||
45 | 100001 | 47.7ms | my $self = shift; | ||
46 | # From RFC-2616 sec14 | ||||
47 | # Media ranges can be overridden by more specific | ||||
48 | # media ranges or specific media types. If more | ||||
49 | # than one media range applies to a given type, | ||||
50 | # the most specific reference has precedence. | ||||
51 | sort { | ||||
52 | 100001 | 62.9ms | if ( $a->[0] == $b->[0] ) { | ||
53 | $a->[1]->matches_all | ||||
54 | ? 1 | ||||
55 | : ($b->[1]->matches_all | ||||
56 | ? -1 | ||||
57 | : ($a->[1]->minor eq '*' | ||||
58 | ? 1 | ||||
59 | : ($b->[1]->minor eq '*' | ||||
60 | ? -1 | ||||
61 | : ($a->[1]->params_are_empty | ||||
62 | ? 1 | ||||
63 | : ($b->[1]->params_are_empty | ||||
64 | ? -1 | ||||
65 | : 0))))) | ||||
66 | } | ||||
67 | else { | ||||
68 | $b->[0] <=> $a->[0] | ||||
69 | } | ||||
70 | } map { | ||||
71 | my $q = $_; | ||||
72 | 100001 | 459ms | 100001 | 85.0ms | map { [ $q+0, $_ ] } reverse @{ $self->items->{ $q } } # spent 85.0ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 850ns/call |
73 | 100001 | 1.46s | 200002 | 195ms | } keys %{ $self->items }; # spent 112ms making 100001 calls to HTTP::Headers::ActionPack::MediaTypeList::CORE:sort, avg 1µs/call
# spent 83.9ms making 100001 calls to HTTP::Headers::ActionPack::PriorityList::items, avg 839ns/call |
74 | } | ||||
75 | |||||
76 | # spent 1.20s (884ms+317ms) within HTTP::Headers::ActionPack::MediaTypeList::canonicalize_choice which was called 100001 times, avg 12µs/call:
# 100001 times (884ms+317ms) by HTTP::Headers::ActionPack::PriorityList::add at line 53 of HTTP/Headers/ActionPack/PriorityList.pm, avg 12µs/call | ||||
77 | 100001 | 1.62s | 100001 | 317ms | return blessed $_[1] # spent 317ms making 100001 calls to Scalar::Util::blessed, avg 3µs/call |
78 | ? $_[1] | ||||
79 | : HTTP::Headers::ActionPack::MediaType->new( $_[1] ); | ||||
80 | } | ||||
81 | |||||
82 | 1 | 3µs | 1; | ||
83 | |||||
84 | __END__ | ||||
# spent 112ms within HTTP::Headers::ActionPack::MediaTypeList::CORE:sort which was called 100001 times, avg 1µs/call:
# 100001 times (112ms+0s) by HTTP::Headers::ActionPack::MediaTypeList::iterable at line 73, avg 1µs/call |