| Filename | /usr/lib/perl/5.18/IO/Socket/INET.pm |
| Statements | Executed 1500095 statements in 5.24s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 100001 | 1 | 1 | 1.47s | 5.70s | IO::Socket::INET::peerhost |
| 100001 | 1 | 1 | 1.31s | 2.16s | IO::Socket::INET::peerport |
| 100001 | 1 | 1 | 1.30s | 3.78s | IO::Socket::INET::peeraddr |
| 100003 | 2 | 2 | 1.06s | 14.5s | IO::Socket::INET::new |
| 1 | 1 | 1 | 2.06ms | 11.4ms | IO::Socket::INET::BEGIN@11 |
| 1 | 1 | 1 | 39µs | 168µs | IO::Socket::INET::configure |
| 1 | 1 | 1 | 25µs | 34µs | IO::Socket::INET::_sock_info |
| 1 | 1 | 1 | 17µs | 39µs | IO::Socket::INET::BEGIN@14 |
| 1 | 1 | 1 | 16µs | 668µs | IO::Socket::INET::BEGIN@12 |
| 1 | 1 | 1 | 11µs | 28µs | IO::Socket::INET::bind |
| 1 | 1 | 1 | 10µs | 18µs | IO::Socket::INET::BEGIN@9 |
| 1 | 1 | 1 | 8µs | 18µs | IO::Socket::INET::BEGIN@15 |
| 1 | 1 | 1 | 7µs | 36µs | IO::Socket::INET::BEGIN@13 |
| 3 | 3 | 1 | 5µs | 5µs | IO::Socket::INET::CORE:match (opcode) |
| 1 | 1 | 1 | 4µs | 4µs | IO::Socket::INET::_get_proto_number |
| 1 | 1 | 1 | 3µs | 3µs | IO::Socket::INET::_get_proto_name |
| 2 | 2 | 1 | 2µs | 2µs | IO::Socket::INET::CORE:subst (opcode) |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::_cache_proto |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::_error |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::_get_addr |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::connect |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::sockaddr |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::sockhost |
| 0 | 0 | 0 | 0s | 0s | IO::Socket::INET::sockport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # IO::Socket::INET.pm | ||||
| 2 | # | ||||
| 3 | # Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved. | ||||
| 4 | # This program is free software; you can redistribute it and/or | ||||
| 5 | # modify it under the same terms as Perl itself. | ||||
| 6 | |||||
| 7 | package IO::Socket::INET; | ||||
| 8 | |||||
| 9 | 2 | 31µs | 2 | 27µs | # spent 18µs (10+9) within IO::Socket::INET::BEGIN@9 which was called:
# once (10µs+9µs) by HTTP::Server::PSGI::BEGIN@8 at line 9 # spent 18µs making 1 call to IO::Socket::INET::BEGIN@9
# spent 9µs making 1 call to strict::import |
| 10 | 1 | 400ns | our(@ISA, $VERSION); | ||
| 11 | 2 | 124µs | 2 | 17.2ms | # spent 11.4ms (2.06+9.36) within IO::Socket::INET::BEGIN@11 which was called:
# once (2.06ms+9.36ms) by HTTP::Server::PSGI::BEGIN@8 at line 11 # spent 11.4ms making 1 call to IO::Socket::INET::BEGIN@11
# spent 5.73ms making 1 call to IO::Socket::import |
| 12 | 2 | 25µs | 2 | 1.32ms | # spent 668µs (16+653) within IO::Socket::INET::BEGIN@12 which was called:
# once (16µs+653µs) by HTTP::Server::PSGI::BEGIN@8 at line 12 # spent 668µs making 1 call to IO::Socket::INET::BEGIN@12
# spent 653µs making 1 call to Exporter::import |
| 13 | 2 | 21µs | 2 | 66µs | # spent 36µs (7+30) within IO::Socket::INET::BEGIN@13 which was called:
# once (7µs+30µs) by HTTP::Server::PSGI::BEGIN@8 at line 13 # spent 36µs making 1 call to IO::Socket::INET::BEGIN@13
# spent 30µs making 1 call to Exporter::import |
| 14 | 2 | 23µs | 2 | 61µs | # spent 39µs (17+22) within IO::Socket::INET::BEGIN@14 which was called:
# once (17µs+22µs) by HTTP::Server::PSGI::BEGIN@8 at line 14 # spent 39µs making 1 call to IO::Socket::INET::BEGIN@14
# spent 22µs making 1 call to Exporter::import |
| 15 | 2 | 1.33ms | 2 | 28µs | # spent 18µs (8+10) within IO::Socket::INET::BEGIN@15 which was called:
# once (8µs+10µs) by HTTP::Server::PSGI::BEGIN@8 at line 15 # spent 18µs making 1 call to IO::Socket::INET::BEGIN@15
# spent 10µs making 1 call to Exporter::import |
| 16 | |||||
| 17 | 1 | 13µs | @ISA = qw(IO::Socket); | ||
| 18 | 1 | 400ns | $VERSION = "1.33"; | ||
| 19 | |||||
| 20 | 1 | 600ns | my $EINVAL = exists(&Errno::EINVAL) ? Errno::EINVAL() : 1; | ||
| 21 | |||||
| 22 | 1 | 5µs | 1 | 3µs | IO::Socket::INET->register_domain( AF_INET ); # spent 3µs making 1 call to IO::Socket::register_domain |
| 23 | |||||
| 24 | 1 | 1µs | my %socket_type = ( tcp => SOCK_STREAM, | ||
| 25 | udp => SOCK_DGRAM, | ||||
| 26 | icmp => SOCK_RAW | ||||
| 27 | ); | ||||
| 28 | 1 | 300ns | my %proto_number; | ||
| 29 | 1 | 700ns | $proto_number{tcp} = Socket::IPPROTO_TCP() if defined &Socket::IPPROTO_TCP; | ||
| 30 | 1 | 900ns | $proto_number{udp} = Socket::IPPROTO_UDP() if defined &Socket::IPPROTO_UDP; | ||
| 31 | 1 | 200ns | $proto_number{icmp} = Socket::IPPROTO_ICMP() if defined &Socket::IPPROTO_ICMP; | ||
| 32 | 1 | 5µs | my %proto_name = reverse %proto_number; | ||
| 33 | |||||
| 34 | # spent 14.5s (1.06+13.5) within IO::Socket::INET::new which was called 100003 times, avg 145µs/call:
# 100002 times (1.06s+13.5s) by IO::Socket::accept at line 232 of IO/Socket.pm, avg 145µs/call
# once (8µs+261µs) by HTTP::Server::PSGI::setup_listener at line 94 of HTTP/Server/PSGI.pm | ||||
| 35 | 100003 | 76.4ms | my $class = shift; | ||
| 36 | 100003 | 100ms | unshift(@_, "PeerAddr") if @_ == 1; | ||
| 37 | 100003 | 871ms | 100003 | 13.5s | return $class->SUPER::new(@_); # spent 13.5s making 100003 calls to IO::Socket::new, avg 135µs/call |
| 38 | } | ||||
| 39 | |||||
| 40 | sub _cache_proto { | ||||
| 41 | my @proto = @_; | ||||
| 42 | for (map lc($_), $proto[0], split(' ', $proto[1])) { | ||||
| 43 | $proto_number{$_} = $proto[2]; | ||||
| 44 | } | ||||
| 45 | $proto_name{$proto[2]} = $proto[0]; | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | # spent 4µs within IO::Socket::INET::_get_proto_number which was called:
# once (4µs+0s) by IO::Socket::INET::_sock_info at line 81 | ||||
| 49 | 1 | 1µs | my $name = lc(shift); | ||
| 50 | 1 | 300ns | return undef unless defined $name; | ||
| 51 | 1 | 3µs | return $proto_number{$name} if exists $proto_number{$name}; | ||
| 52 | |||||
| 53 | my @proto = getprotobyname($name); | ||||
| 54 | return undef unless @proto; | ||||
| 55 | _cache_proto(@proto); | ||||
| 56 | |||||
| 57 | return $proto[2]; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | # spent 3µs within IO::Socket::INET::_get_proto_name which was called:
# once (3µs+0s) by IO::Socket::INET::configure at line 167 | ||||
| 61 | 1 | 500ns | my $num = shift; | ||
| 62 | 1 | 100ns | return undef unless defined $num; | ||
| 63 | 1 | 3µs | return $proto_name{$num} if exists $proto_name{$num}; | ||
| 64 | |||||
| 65 | my @proto = getprotobynumber($num); | ||||
| 66 | return undef unless @proto; | ||||
| 67 | _cache_proto(@proto); | ||||
| 68 | |||||
| 69 | return $proto[0]; | ||||
| 70 | } | ||||
| 71 | |||||
| 72 | # spent 34µs (25+10) within IO::Socket::INET::_sock_info which was called:
# once (25µs+10µs) by IO::Socket::INET::configure at line 144 | ||||
| 73 | 1 | 700ns | my($addr,$port,$proto) = @_; | ||
| 74 | 1 | 300ns | my $origport = $port; | ||
| 75 | 1 | 400ns | my @serv = (); | ||
| 76 | |||||
| 77 | 1 | 5µs | 1 | 1µs | $port = $1 # spent 1µs making 1 call to IO::Socket::INET::CORE:subst |
| 78 | if(defined $addr && $addr =~ s,:([\w\(\)/]+)$,,); | ||||
| 79 | |||||
| 80 | 1 | 6µs | 1 | 2µs | if(defined $proto && $proto =~ /\D/) { # spent 2µs making 1 call to IO::Socket::INET::CORE:match |
| 81 | 1 | 2µs | 1 | 4µs | my $num = _get_proto_number($proto); # spent 4µs making 1 call to IO::Socket::INET::_get_proto_number |
| 82 | 1 | 300ns | unless (defined $num) { | ||
| 83 | $@ = "Bad protocol '$proto'"; | ||||
| 84 | return; | ||||
| 85 | } | ||||
| 86 | 1 | 400ns | $proto = $num; | ||
| 87 | } | ||||
| 88 | |||||
| 89 | 1 | 500ns | if(defined $port) { | ||
| 90 | 1 | 3µs | 1 | 400ns | my $defport = ($port =~ s,\((\d+)\)$,,) ? $1 : undef; # spent 400ns making 1 call to IO::Socket::INET::CORE:subst |
| 91 | 1 | 5µs | 1 | 2µs | my $pnum = ($port =~ m,^(\d+)$,)[0]; # spent 2µs making 1 call to IO::Socket::INET::CORE:match |
| 92 | |||||
| 93 | 1 | 2µs | 1 | 600ns | @serv = getservbyname($port, _get_proto_name($proto) || "") # spent 600ns making 1 call to IO::Socket::INET::CORE:match |
| 94 | if ($port =~ m,\D,); | ||||
| 95 | |||||
| 96 | 1 | 500ns | $port = $serv[2] || $defport || $pnum; | ||
| 97 | 1 | 300ns | unless (defined $port) { | ||
| 98 | $@ = "Bad service '$origport'"; | ||||
| 99 | return; | ||||
| 100 | } | ||||
| 101 | |||||
| 102 | 1 | 500ns | $proto = _get_proto_number($serv[3]) if @serv && !$proto; | ||
| 103 | } | ||||
| 104 | |||||
| 105 | 1 | 3µs | return ($addr || undef, | ||
| 106 | $port || undef, | ||||
| 107 | $proto || undef | ||||
| 108 | ); | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | sub _error { | ||||
| 112 | my $sock = shift; | ||||
| 113 | my $err = shift; | ||||
| 114 | { | ||||
| 115 | local($!); | ||||
| 116 | my $title = ref($sock).": "; | ||||
| 117 | $@ = join("", $_[0] =~ /^$title/ ? "" : $title, @_); | ||||
| 118 | $sock->close() | ||||
| 119 | if(defined fileno($sock)); | ||||
| 120 | } | ||||
| 121 | $! = $err; | ||||
| 122 | return undef; | ||||
| 123 | } | ||||
| 124 | |||||
| 125 | sub _get_addr { | ||||
| 126 | my($sock,$addr_str, $multi) = @_; | ||||
| 127 | my @addr; | ||||
| 128 | if ($multi && $addr_str !~ /^\d+(?:\.\d+){3}$/) { | ||||
| 129 | (undef, undef, undef, undef, @addr) = gethostbyname($addr_str); | ||||
| 130 | } else { | ||||
| 131 | my $h = inet_aton($addr_str); | ||||
| 132 | push(@addr, $h) if defined $h; | ||||
| 133 | } | ||||
| 134 | @addr; | ||||
| 135 | } | ||||
| 136 | |||||
| 137 | # spent 168µs (39+128) within IO::Socket::INET::configure which was called:
# once (39µs+128µs) by IO::Socket::new at line 48 of IO/Socket.pm | ||||
| 138 | 1 | 400ns | my($sock,$arg) = @_; | ||
| 139 | 1 | 200ns | my($lport,$rport,$laddr,$raddr,$proto,$type); | ||
| 140 | |||||
| 141 | 1 | 1µs | $arg->{LocalAddr} = $arg->{LocalHost} | ||
| 142 | if exists $arg->{LocalHost} && !exists $arg->{LocalAddr}; | ||||
| 143 | |||||
| 144 | 1 | 4µs | 1 | 34µs | ($laddr,$lport,$proto) = _sock_info($arg->{LocalAddr}, # spent 34µs making 1 call to IO::Socket::INET::_sock_info |
| 145 | $arg->{LocalPort}, | ||||
| 146 | $arg->{Proto}) | ||||
| 147 | or return _error($sock, $!, $@); | ||||
| 148 | |||||
| 149 | 1 | 1µs | $laddr = defined $laddr ? inet_aton($laddr) | ||
| 150 | : INADDR_ANY; | ||||
| 151 | |||||
| 152 | 1 | 300ns | return _error($sock, $EINVAL, "Bad hostname '",$arg->{LocalAddr},"'") | ||
| 153 | unless(defined $laddr); | ||||
| 154 | |||||
| 155 | 1 | 500ns | $arg->{PeerAddr} = $arg->{PeerHost} | ||
| 156 | if exists $arg->{PeerHost} && !exists $arg->{PeerAddr}; | ||||
| 157 | |||||
| 158 | 1 | 500ns | unless(exists $arg->{Listen}) { | ||
| 159 | ($raddr,$rport,$proto) = _sock_info($arg->{PeerAddr}, | ||||
| 160 | $arg->{PeerPort}, | ||||
| 161 | $proto) | ||||
| 162 | or return _error($sock, $!, $@); | ||||
| 163 | } | ||||
| 164 | |||||
| 165 | 1 | 200ns | $proto ||= _get_proto_number('tcp'); | ||
| 166 | |||||
| 167 | 1 | 2µs | 1 | 3µs | $type = $arg->{Type} || $socket_type{lc _get_proto_name($proto)}; # spent 3µs making 1 call to IO::Socket::INET::_get_proto_name |
| 168 | |||||
| 169 | 1 | 1µs | my @raddr = (); | ||
| 170 | |||||
| 171 | 1 | 200ns | if(defined $raddr) { | ||
| 172 | @raddr = $sock->_get_addr($raddr, $arg->{MultiHomed}); | ||||
| 173 | return _error($sock, $EINVAL, "Bad hostname '",$arg->{PeerAddr},"'") | ||||
| 174 | unless @raddr; | ||||
| 175 | } | ||||
| 176 | |||||
| 177 | 1 | 200ns | while(1) { | ||
| 178 | |||||
| 179 | 1 | 4µs | 1 | 32µs | $sock->socket(AF_INET, $type, $proto) or # spent 32µs making 1 call to IO::Socket::socket |
| 180 | return _error($sock, $!, "$!"); | ||||
| 181 | |||||
| 182 | 1 | 1µs | if (defined $arg->{Blocking}) { | ||
| 183 | defined $sock->blocking($arg->{Blocking}) | ||||
| 184 | or return _error($sock, $!, "$!"); | ||||
| 185 | } | ||||
| 186 | |||||
| 187 | 1 | 1µs | if ($arg->{Reuse} || $arg->{ReuseAddr}) { | ||
| 188 | 1 | 4µs | 1 | 18µs | $sock->sockopt(SO_REUSEADDR,1) or # spent 18µs making 1 call to IO::Socket::sockopt |
| 189 | return _error($sock, $!, "$!"); | ||||
| 190 | } | ||||
| 191 | |||||
| 192 | 1 | 500ns | if ($arg->{ReusePort}) { | ||
| 193 | $sock->sockopt(SO_REUSEPORT,1) or | ||||
| 194 | return _error($sock, $!, "$!"); | ||||
| 195 | } | ||||
| 196 | |||||
| 197 | 1 | 400ns | if ($arg->{Broadcast}) { | ||
| 198 | $sock->sockopt(SO_BROADCAST,1) or | ||||
| 199 | return _error($sock, $!, "$!"); | ||||
| 200 | } | ||||
| 201 | |||||
| 202 | 1 | 600ns | if($lport || ($laddr ne INADDR_ANY) || exists $arg->{Listen}) { | ||
| 203 | 1 | 2µs | 1 | 28µs | $sock->bind($lport || 0, $laddr) or # spent 28µs making 1 call to IO::Socket::INET::bind |
| 204 | return _error($sock, $!, "$!"); | ||||
| 205 | } | ||||
| 206 | |||||
| 207 | 1 | 500ns | if(exists $arg->{Listen}) { | ||
| 208 | 1 | 3µs | 1 | 13µs | $sock->listen($arg->{Listen} || 5) or # spent 13µs making 1 call to IO::Socket::listen |
| 209 | return _error($sock, $!, "$!"); | ||||
| 210 | 1 | 1µs | last; | ||
| 211 | } | ||||
| 212 | |||||
| 213 | # don't try to connect unless we're given a PeerAddr | ||||
| 214 | last unless exists($arg->{PeerAddr}); | ||||
| 215 | |||||
| 216 | $raddr = shift @raddr; | ||||
| 217 | |||||
| 218 | return _error($sock, $EINVAL, 'Cannot determine remote port') | ||||
| 219 | unless($rport || $type == SOCK_DGRAM || $type == SOCK_RAW); | ||||
| 220 | |||||
| 221 | last | ||||
| 222 | unless($type == SOCK_STREAM || defined $raddr); | ||||
| 223 | |||||
| 224 | return _error($sock, $EINVAL, "Bad hostname '",$arg->{PeerAddr},"'") | ||||
| 225 | unless defined $raddr; | ||||
| 226 | |||||
| 227 | # my $timeout = ${*$sock}{'io_socket_timeout'}; | ||||
| 228 | # my $before = time() if $timeout; | ||||
| 229 | |||||
| 230 | undef $@; | ||||
| 231 | if ($sock->connect(pack_sockaddr_in($rport, $raddr))) { | ||||
| 232 | # ${*$sock}{'io_socket_timeout'} = $timeout; | ||||
| 233 | return $sock; | ||||
| 234 | } | ||||
| 235 | |||||
| 236 | return _error($sock, $!, $@ || "Timeout") | ||||
| 237 | unless @raddr; | ||||
| 238 | |||||
| 239 | # if ($timeout) { | ||||
| 240 | # my $new_timeout = $timeout - (time() - $before); | ||||
| 241 | # return _error($sock, | ||||
| 242 | # (exists(&Errno::ETIMEDOUT) ? Errno::ETIMEDOUT() : $EINVAL), | ||||
| 243 | # "Timeout") if $new_timeout <= 0; | ||||
| 244 | # ${*$sock}{'io_socket_timeout'} = $new_timeout; | ||||
| 245 | # } | ||||
| 246 | |||||
| 247 | } | ||||
| 248 | |||||
| 249 | 1 | 3µs | $sock; | ||
| 250 | } | ||||
| 251 | |||||
| 252 | sub connect { | ||||
| 253 | @_ == 2 || @_ == 3 or | ||||
| 254 | croak 'usage: $sock->connect(NAME) or $sock->connect(PORT, ADDR)'; | ||||
| 255 | my $sock = shift; | ||||
| 256 | return $sock->SUPER::connect(@_ == 1 ? shift : pack_sockaddr_in(@_)); | ||||
| 257 | } | ||||
| 258 | |||||
| 259 | # spent 28µs (11+17) within IO::Socket::INET::bind which was called:
# once (11µs+17µs) by IO::Socket::INET::configure at line 203 | ||||
| 260 | 1 | 600ns | @_ == 2 || @_ == 3 or | ||
| 261 | croak 'usage: $sock->bind(NAME) or $sock->bind(PORT, ADDR)'; | ||||
| 262 | 1 | 400ns | my $sock = shift; | ||
| 263 | 1 | 14µs | 2 | 17µs | return $sock->SUPER::bind(@_ == 1 ? shift : pack_sockaddr_in(@_)) # spent 12µs making 1 call to IO::Socket::bind
# spent 5µs making 1 call to Socket::pack_sockaddr_in |
| 264 | } | ||||
| 265 | |||||
| 266 | sub sockaddr { | ||||
| 267 | @_ == 1 or croak 'usage: $sock->sockaddr()'; | ||||
| 268 | my($sock) = @_; | ||||
| 269 | my $name = $sock->sockname; | ||||
| 270 | $name ? (sockaddr_in($name))[1] : undef; | ||||
| 271 | } | ||||
| 272 | |||||
| 273 | sub sockport { | ||||
| 274 | @_ == 1 or croak 'usage: $sock->sockport()'; | ||||
| 275 | my($sock) = @_; | ||||
| 276 | my $name = $sock->sockname; | ||||
| 277 | $name ? (sockaddr_in($name))[0] : undef; | ||||
| 278 | } | ||||
| 279 | |||||
| 280 | sub sockhost { | ||||
| 281 | @_ == 1 or croak 'usage: $sock->sockhost()'; | ||||
| 282 | my($sock) = @_; | ||||
| 283 | my $addr = $sock->sockaddr; | ||||
| 284 | $addr ? inet_ntoa($addr) : undef; | ||||
| 285 | } | ||||
| 286 | |||||
| 287 | # spent 3.78s (1.30+2.48) within IO::Socket::INET::peeraddr which was called 100001 times, avg 38µs/call:
# 100001 times (1.30s+2.48s) by IO::Socket::INET::peerhost at line 304, avg 38µs/call | ||||
| 288 | 100001 | 72.1ms | @_ == 1 or croak 'usage: $sock->peeraddr()'; | ||
| 289 | 100001 | 51.9ms | my($sock) = @_; | ||
| 290 | 100001 | 330ms | 100001 | 1.15s | my $name = $sock->peername; # spent 1.15s making 100001 calls to IO::Socket::peername, avg 12µs/call |
| 291 | 100001 | 845ms | 100001 | 1.33s | $name ? (sockaddr_in($name))[1] : undef; # spent 1.33s making 100001 calls to Socket::sockaddr_in, avg 13µs/call |
| 292 | } | ||||
| 293 | |||||
| 294 | # spent 2.16s (1.31+856ms) within IO::Socket::INET::peerport which was called 100001 times, avg 22µs/call:
# 100001 times (1.31s+856ms) by HTTP::Server::PSGI::accept_loop at line 110 of HTTP/Server/PSGI.pm, avg 22µs/call | ||||
| 295 | 100001 | 82.4ms | @_ == 1 or croak 'usage: $sock->peerport()'; | ||
| 296 | 100001 | 60.7ms | my($sock) = @_; | ||
| 297 | 100001 | 201ms | 100001 | 189ms | my $name = $sock->peername; # spent 189ms making 100001 calls to IO::Socket::peername, avg 2µs/call |
| 298 | 100001 | 606ms | 100001 | 667ms | $name ? (sockaddr_in($name))[0] : undef; # spent 667ms making 100001 calls to Socket::sockaddr_in, avg 7µs/call |
| 299 | } | ||||
| 300 | |||||
| 301 | # spent 5.70s (1.47+4.23) within IO::Socket::INET::peerhost which was called 100001 times, avg 57µs/call:
# 100001 times (1.47s+4.23s) by HTTP::Server::PSGI::accept_loop at line 110 of HTTP/Server/PSGI.pm, avg 57µs/call | ||||
| 302 | 100001 | 77.9ms | @_ == 1 or croak 'usage: $sock->peerhost()'; | ||
| 303 | 100001 | 67.6ms | my($sock) = @_; | ||
| 304 | 100001 | 333ms | 100001 | 3.78s | my $addr = $sock->peeraddr; # spent 3.78s making 100001 calls to IO::Socket::INET::peeraddr, avg 38µs/call |
| 305 | 100001 | 1.46s | 100001 | 456ms | $addr ? inet_ntoa($addr) : undef; # spent 456ms making 100001 calls to Socket::inet_ntoa, avg 5µs/call |
| 306 | } | ||||
| 307 | |||||
| 308 | 1 | 16µs | 1; | ||
| 309 | |||||
| 310 | __END__ | ||||
sub IO::Socket::INET::CORE:match; # opcode | |||||
sub IO::Socket::INET::CORE:subst; # opcode |