| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/URI/_server.pm |
| Statements | Executed 36046 statements in 104ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2002 | 1 | 1 | 32.9ms | 72.1ms | URI::_server::_uric_escape |
| 1001 | 1 | 1 | 18.2ms | 21.4ms | URI::_server::userinfo |
| 1001 | 1 | 1 | 16.9ms | 28.1ms | URI::_server::_port |
| 2002 | 1 | 1 | 15.1ms | 19.0ms | URI::_server::_host_escape |
| 1001 | 1 | 1 | 10.9ms | 26.3ms | URI::_server::host |
| 7007 | 5 | 1 | 7.02ms | 7.02ms | URI::_server::CORE:subst (opcode) |
| 6006 | 4 | 1 | 6.98ms | 6.98ms | URI::_server::CORE:match (opcode) |
| 1001 | 1 | 1 | 4.85ms | 32.9ms | URI::_server::port |
| 2003 | 2 | 1 | 2.57ms | 2.57ms | URI::_server::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 8µs | 9µs | URI::_server::BEGIN@3 |
| 1 | 1 | 1 | 6µs | 21µs | URI::_server::BEGIN@8 |
| 1 | 1 | 1 | 5µs | 1.55ms | URI::_server::BEGIN@6 |
| 1 | 1 | 1 | 3µs | 6µs | URI::_server::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | URI::_server::as_iri |
| 0 | 0 | 0 | 0s | 0s | URI::_server::canonical |
| 0 | 0 | 0 | 0s | 0s | URI::_server::default_port |
| 0 | 0 | 0 | 0s | 0s | URI::_server::host_port |
| 0 | 0 | 0 | 0s | 0s | URI::_server::ihost |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package URI::_server; | ||||
| 2 | |||||
| 3 | 2 | 14µs | 2 | 10µs | # spent 9µs (8+1) within URI::_server::BEGIN@3 which was called:
# once (8µs+1µs) by parent::import at line 3 # spent 9µs making 1 call to URI::_server::BEGIN@3
# spent 1µs making 1 call to strict::import |
| 4 | 2 | 13µs | 2 | 8µs | # spent 6µs (3+3) within URI::_server::BEGIN@4 which was called:
# once (3µs+3µs) by parent::import at line 4 # spent 6µs making 1 call to URI::_server::BEGIN@4
# spent 3µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 2 | 21µs | 2 | 1.55ms | # spent 1.55ms (5µs+1.54) within URI::_server::BEGIN@6 which was called:
# once (5µs+1.54ms) by parent::import at line 6 # spent 1.55ms making 1 call to URI::_server::BEGIN@6
# spent 1.54ms making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 1.54ms |
| 7 | |||||
| 8 | 2 | 628µs | 2 | 37µs | # spent 21µs (6+16) within URI::_server::BEGIN@8 which was called:
# once (6µs+16µs) by parent::import at line 8 # spent 21µs making 1 call to URI::_server::BEGIN@8
# spent 16µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 400ns | our $VERSION = "1.69"; | ||
| 11 | |||||
| 12 | # spent 72.1ms (32.9+39.2) within URI::_server::_uric_escape which was called 2002 times, avg 36µs/call:
# 2002 times (32.9ms+39.2ms) by URI::_init at line 81 of URI.pm, avg 36µs/call | ||||
| 13 | 2002 | 719µs | my($class, $str) = @_; | ||
| 14 | 2002 | 7.73ms | 2003 | 3.86ms | if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) { # spent 3.85ms making 2002 calls to URI::_server::CORE:match, avg 2µs/call
# spent 16µs making 1 call to URI::_server::CORE:regcomp |
| 15 | 2002 | 3.70ms | my($scheme, $host, $rest) = ($1, $2, $3); | ||
| 16 | 2002 | 11.3ms | 2002 | 1.06ms | my $ui = $host =~ s/(.*@)// ? $1 : ""; # spent 1.06ms making 2002 calls to URI::_server::CORE:subst, avg 529ns/call |
| 17 | 2002 | 6.63ms | 2002 | 3.42ms | my $port = $host =~ s/(:\d+)\z// ? $1 : ""; # spent 3.42ms making 2002 calls to URI::_server::CORE:subst, avg 2µs/call |
| 18 | 2002 | 3.23ms | 2002 | 19.0ms | if (_host_escape($host)) { # spent 19.0ms making 2002 calls to URI::_server::_host_escape, avg 10µs/call |
| 19 | $str = "$scheme//$ui$host$port$rest"; | ||||
| 20 | } | ||||
| 21 | } | ||||
| 22 | 2002 | 6.52ms | 2002 | 11.8ms | return $class->SUPER::_uric_escape($str); # spent 11.8ms making 2002 calls to URI::_uric_escape, avg 6µs/call |
| 23 | } | ||||
| 24 | |||||
| 25 | # spent 19.0ms (15.1+3.94) within URI::_server::_host_escape which was called 2002 times, avg 10µs/call:
# 2002 times (15.1ms+3.94ms) by URI::_server::_uric_escape at line 18, avg 10µs/call | ||||
| 26 | 2002 | 19.9ms | 4004 | 3.94ms | return unless $_[0] =~ /[^$URI::uric]/; # spent 2.55ms making 2002 calls to URI::_server::CORE:regcomp, avg 1µs/call
# spent 1.39ms making 2002 calls to URI::_server::CORE:match, avg 693ns/call |
| 27 | eval { | ||||
| 28 | require URI::_idna; | ||||
| 29 | $_[0] = URI::_idna::encode($_[0]); | ||||
| 30 | }; | ||||
| 31 | return 0 if $@; | ||||
| 32 | return 1; | ||||
| 33 | } | ||||
| 34 | |||||
| 35 | sub as_iri { | ||||
| 36 | my $self = shift; | ||||
| 37 | my $str = $self->SUPER::as_iri; | ||||
| 38 | if ($str =~ /\bxn--/) { | ||||
| 39 | if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) { | ||||
| 40 | my($scheme, $host, $rest) = ($1, $2, $3); | ||||
| 41 | my $ui = $host =~ s/(.*@)// ? $1 : ""; | ||||
| 42 | my $port = $host =~ s/(:\d+)\z// ? $1 : ""; | ||||
| 43 | require URI::_idna; | ||||
| 44 | $host = URI::_idna::decode($host); | ||||
| 45 | $str = "$scheme//$ui$host$port$rest"; | ||||
| 46 | } | ||||
| 47 | } | ||||
| 48 | return $str; | ||||
| 49 | } | ||||
| 50 | |||||
| 51 | sub userinfo | ||||
| 52 | # spent 21.4ms (18.2+3.15) within URI::_server::userinfo which was called 1001 times, avg 21µs/call:
# 1001 times (18.2ms+3.15ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 21µs/call | ||||
| 53 | 1001 | 337µs | my $self = shift; | ||
| 54 | 1001 | 1.08ms | 1001 | 2.68ms | my $old = $self->authority; # spent 2.68ms making 1001 calls to URI::_generic::authority, avg 3µs/call |
| 55 | |||||
| 56 | 1001 | 362µs | if (@_) { | ||
| 57 | my $new = $old; | ||||
| 58 | $new = "" unless defined $new; | ||||
| 59 | $new =~ s/.*@//; # remove old stuff | ||||
| 60 | my $ui = shift; | ||||
| 61 | if (defined $ui) { | ||||
| 62 | $ui =~ s/@/%40/g; # protect @ | ||||
| 63 | $new = "$ui\@$new"; | ||||
| 64 | } | ||||
| 65 | $self->authority($new); | ||||
| 66 | } | ||||
| 67 | 1001 | 16.4ms | 1001 | 472µs | return undef if !defined($old) || $old !~ /(.*)@/; # spent 472µs making 1001 calls to URI::_server::CORE:match, avg 471ns/call |
| 68 | return $1; | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | sub host | ||||
| 72 | # spent 26.3ms (10.9+15.4) within URI::_server::host which was called 1001 times, avg 26µs/call:
# 1001 times (10.9ms+15.4ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 26µs/call | ||||
| 73 | 1001 | 408µs | my $self = shift; | ||
| 74 | 1001 | 2.46ms | 1001 | 7.42ms | my $old = $self->authority; # spent 7.42ms making 1001 calls to URI::_generic::authority, avg 7µs/call |
| 75 | 1001 | 430µs | if (@_) { | ||
| 76 | my $tmp = $old; | ||||
| 77 | $tmp = "" unless defined $tmp; | ||||
| 78 | my $ui = ($tmp =~ /(.*@)/) ? $1 : ""; | ||||
| 79 | my $port = ($tmp =~ /(:\d+)$/) ? $1 : ""; | ||||
| 80 | my $new = shift; | ||||
| 81 | $new = "" unless defined $new; | ||||
| 82 | if (length $new) { | ||||
| 83 | $new =~ s/[@]/%40/g; # protect @ | ||||
| 84 | if ($new =~ /^[^:]*:\d*\z/ || $new =~ /]:\d*\z/) { | ||||
| 85 | $new =~ s/(:\d*)\z// || die "Assert"; | ||||
| 86 | $port = $1; | ||||
| 87 | } | ||||
| 88 | $new = "[$new]" if $new =~ /:/ && $new !~ /^\[/; # IPv6 address | ||||
| 89 | _host_escape($new); | ||||
| 90 | } | ||||
| 91 | $self->authority("$ui$new$port"); | ||||
| 92 | } | ||||
| 93 | 1001 | 421µs | return undef unless defined $old; | ||
| 94 | 1001 | 1.98ms | 1001 | 591µs | $old =~ s/.*@//; # spent 591µs making 1001 calls to URI::_server::CORE:subst, avg 590ns/call |
| 95 | 1001 | 2.82ms | 1001 | 1.42ms | $old =~ s/:\d+$//; # remove the port # spent 1.42ms making 1001 calls to URI::_server::CORE:subst, avg 1µs/call |
| 96 | 1001 | 1.69ms | 1001 | 528µs | $old =~ s{^\[(.*)\]$}{$1}; # remove brackets around IPv6 (RFC 3986 3.2.2) # spent 528µs making 1001 calls to URI::_server::CORE:subst, avg 528ns/call |
| 97 | 1001 | 3.54ms | 1001 | 5.44ms | return uri_unescape($old); # spent 5.44ms making 1001 calls to URI::Escape::uri_unescape, avg 5µs/call |
| 98 | } | ||||
| 99 | |||||
| 100 | sub ihost | ||||
| 101 | { | ||||
| 102 | my $self = shift; | ||||
| 103 | my $old = $self->host(@_); | ||||
| 104 | if ($old =~ /(^|\.)xn--/) { | ||||
| 105 | require URI::_idna; | ||||
| 106 | $old = URI::_idna::decode($old); | ||||
| 107 | } | ||||
| 108 | return $old; | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | sub _port | ||||
| 112 | # spent 28.1ms (16.9+11.1) within URI::_server::_port which was called 1001 times, avg 28µs/call:
# 1001 times (16.9ms+11.1ms) by URI::_server::port at line 129, avg 28µs/call | ||||
| 113 | 1001 | 308µs | my $self = shift; | ||
| 114 | 1001 | 1.15ms | 1001 | 9.87ms | my $old = $self->authority; # spent 9.87ms making 1001 calls to URI::_generic::authority, avg 10µs/call |
| 115 | 1001 | 370µs | if (@_) { | ||
| 116 | my $new = $old; | ||||
| 117 | $new =~ s/:\d*$//; | ||||
| 118 | my $port = shift; | ||||
| 119 | $new .= ":$port" if defined $port; | ||||
| 120 | $self->authority($new); | ||||
| 121 | } | ||||
| 122 | 1001 | 4.62ms | 1001 | 1.28ms | return $1 if defined($old) && $old =~ /:(\d*)$/; # spent 1.28ms making 1001 calls to URI::_server::CORE:match, avg 1µs/call |
| 123 | return; | ||||
| 124 | } | ||||
| 125 | |||||
| 126 | sub port | ||||
| 127 | # spent 32.9ms (4.85+28.1) within URI::_server::port which was called 1001 times, avg 33µs/call:
# 1001 times (4.85ms+28.1ms) by Search::Elasticsearch::Role::Cxn::BUILDARGS at line 75 of Search/Elasticsearch/Role/Cxn.pm, avg 33µs/call | ||||
| 128 | 1001 | 376µs | my $self = shift; | ||
| 129 | 1001 | 1.89ms | 1001 | 28.1ms | my $port = $self->_port(@_); # spent 28.1ms making 1001 calls to URI::_server::_port, avg 28µs/call |
| 130 | 1001 | 948µs | $port = $self->default_port if !defined($port) || $port eq ""; | ||
| 131 | 1001 | 1.94ms | $port; | ||
| 132 | } | ||||
| 133 | |||||
| 134 | sub host_port | ||||
| 135 | { | ||||
| 136 | my $self = shift; | ||||
| 137 | my $old = $self->authority; | ||||
| 138 | $self->host(shift) if @_; | ||||
| 139 | return undef unless defined $old; | ||||
| 140 | $old =~ s/.*@//; # zap userinfo | ||||
| 141 | $old =~ s/:$//; # empty port should be treated the same a no port | ||||
| 142 | $old .= ":" . $self->port unless $old =~ /:\d+$/; | ||||
| 143 | $old; | ||||
| 144 | } | ||||
| 145 | |||||
| 146 | |||||
| 147 | sub default_port { undef } | ||||
| 148 | |||||
| 149 | sub canonical | ||||
| 150 | { | ||||
| 151 | my $self = shift; | ||||
| 152 | my $other = $self->SUPER::canonical; | ||||
| 153 | my $host = $other->host || ""; | ||||
| 154 | my $port = $other->_port; | ||||
| 155 | my $uc_host = $host =~ /[A-Z]/; | ||||
| 156 | my $def_port = defined($port) && ($port eq "" || | ||||
| 157 | $port == $self->default_port); | ||||
| 158 | if ($uc_host || $def_port) { | ||||
| 159 | $other = $other->clone if $other == $self; | ||||
| 160 | $other->host(lc $host) if $uc_host; | ||||
| 161 | $other->port(undef) if $def_port; | ||||
| 162 | } | ||||
| 163 | $other; | ||||
| 164 | } | ||||
| 165 | |||||
| 166 | 1 | 2µs | 1; | ||
# spent 6.98ms within URI::_server::CORE:match which was called 6006 times, avg 1µs/call:
# 2002 times (3.85ms+0s) by URI::_server::_uric_escape at line 14, avg 2µs/call
# 2002 times (1.39ms+0s) by URI::_server::_host_escape at line 26, avg 693ns/call
# 1001 times (1.28ms+0s) by URI::_server::_port at line 122, avg 1µs/call
# 1001 times (472µs+0s) by URI::_server::userinfo at line 67, avg 471ns/call | |||||
sub URI::_server::CORE:regcomp; # opcode | |||||
# spent 7.02ms within URI::_server::CORE:subst which was called 7007 times, avg 1µs/call:
# 2002 times (3.42ms+0s) by URI::_server::_uric_escape at line 17, avg 2µs/call
# 2002 times (1.06ms+0s) by URI::_server::_uric_escape at line 16, avg 529ns/call
# 1001 times (1.42ms+0s) by URI::_server::host at line 95, avg 1µs/call
# 1001 times (591µs+0s) by URI::_server::host at line 94, avg 590ns/call
# 1001 times (528µs+0s) by URI::_server::host at line 96, avg 528ns/call |