Profile of NetAddr/IP/InetBase.pm

← Index
NYTProf Performance Profile «line view»
For examples/benchmark4.pl
Run on Thu Aug 28 19:01:43 2014
Reported on Thu Aug 28 19:02:42 2014

Filename | /usr/lib/perl5/NetAddr/IP/InetBase.pm
Statements | Executed 430540 statements in 994ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
47822 | 1 | 1 | 350ms | 401ms | NetAddr::IP::InetBase::::fillIPv4NetAddr::IP::InetBase::fillIPv4
47822 | 3 | 1 | 316ms | 946ms | NetAddr::IP::InetBase::::inet_atonNetAddr::IP::InetBase::inet_aton
47822 | 1 | 1 | 229ms | 229ms | NetAddr::IP::InetBase::::CORE:ghbynameNetAddr::IP::InetBase::CORE:ghbyname (opcode)
47844 | 7 | 1 | 51.8ms | 51.8ms | NetAddr::IP::InetBase::::CORE:matchNetAddr::IP::InetBase::CORE:match (opcode)
1 | 1 | 1 | 1.17ms | 1.41ms | NetAddr::IP::InetBase::::BEGIN@9NetAddr::IP::InetBase::BEGIN@9
3 | 2 | 2 | 126µs | 158µs | NetAddr::IP::InetBase::::ipv6_atonNetAddr::IP::InetBase::ipv6_aton
2 | 2 | 2 | 26µs | 352µs | NetAddr::IP::InetBase::::importNetAddr::IP::InetBase::import
3 | 3 | 2 | 23µs | 584µs | NetAddr::IP::InetBase::::inet_any2nNetAddr::IP::InetBase::inet_any2n
16 | 2 | 1 | 16µs | 16µs | NetAddr::IP::InetBase::::CORE:substNetAddr::IP::InetBase::CORE:subst (opcode)
1 | 1 | 1 | 10µs | 42µs | NetAddr::IP::InetBase::::BEGIN@125NetAddr::IP::InetBase::BEGIN@125
1 | 1 | 1 | 10µs | 22µs | NetAddr::IP::InetBase::::BEGIN@4NetAddr::IP::InetBase::BEGIN@4
1 | 1 | 1 | 9µs | 17µs | NetAddr::IP::InetBase::::BEGIN@71NetAddr::IP::InetBase::BEGIN@71
1 | 1 | 1 | 7µs | 65µs | NetAddr::IP::InetBase::::BEGIN@8NetAddr::IP::InetBase::BEGIN@8
1 | 1 | 1 | 6µs | 6µs | NetAddr::IP::InetBase::::BEGIN@124NetAddr::IP::InetBase::BEGIN@124
1 | 1 | 1 | 6µs | 6µs | NetAddr::IP::InetBase::::upperNetAddr::IP::InetBase::upper
3 | 1 | 1 | 3µs | 3µs | NetAddr::IP::InetBase::::CORE:packNetAddr::IP::InetBase::CORE:pack (opcode)
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::DESTROYNetAddr::IP::InetBase::DESTROY
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::__ANON__[:109]NetAddr::IP::InetBase::__ANON__[:109]
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::fake_AF_INET6NetAddr::IP::InetBase::fake_AF_INET6
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::ipv6_n2dNetAddr::IP::InetBase::ipv6_n2d
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::ipv6_n2xNetAddr::IP::InetBase::ipv6_n2x
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::isAnyIPv4NetAddr::IP::InetBase::isAnyIPv4
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::isIPv4NetAddr::IP::InetBase::isIPv4
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::isNewIPv4NetAddr::IP::InetBase::isNewIPv4
0 | 0 | 0 | 0s | 0s | NetAddr::IP::InetBase::::lowerNetAddr::IP::InetBase::lower

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  |
- - |  |  |  |  |
4 | 2 | 29µs | 2 | 33µs | # spent 22µs (10+11) within NetAddr::IP::InetBase::BEGIN@4 which was called: # once (10µs+11µs) by NetAddr::IP::Lite::BEGIN@9 at line 4 # spent 22µs making 1 call to NetAddr::IP::InetBase::BEGIN@4 # spent 11µs making 1 call to strict::import
- - |  |  |  |  |
8 | 2 | 34µs | 2 | 124µs | # spent 65µs (7+59) within NetAddr::IP::InetBase::BEGIN@8 which was called: # once (7µs+59µs) by NetAddr::IP::Lite::BEGIN@9 at line 8 # spent 65µs making 1 call to NetAddr::IP::InetBase::BEGIN@8 # spent 59µs making 1 call to vars::import
9 | 2 | 234µs | 2 | 1.54ms | # spent 1.41ms (1.17+231µs) within NetAddr::IP::InetBase::BEGIN@9 which was called: # once (1.17ms+231µs) by NetAddr::IP::Lite::BEGIN@9 at line 9 # spent 1.41ms making 1 call to NetAddr::IP::InetBase::BEGIN@9 # spent 135µs making 1 call to AutoLoader::import
10 | 1 | 600ns |  |  |
- - |  |  |  |  |
12 | 1 | 7µs |  |  |
- - |  |  |  |  |
14 | 3 | 15µs | 1 | 4µs | # spent 4µs making 1 call to NetAddr::IP::InetBase::CORE:match
- - |  |  |  |  |
16 | 1 | 2µs |  |  |
- - |  |  |  |  |
38 | 1 | 6µs |  |  |
- - |  |  |  |  |
69 | 1 | 300ns |  |  |
- - |  |  |  |  |
71 | 3 | 275µs | 2 | 26µs | # spent 17µs (9+8) within NetAddr::IP::InetBase::BEGIN@71 which was called: # once (9µs+8µs) by NetAddr::IP::Lite::BEGIN@9 at line 71 # spent 17µs making 1 call to NetAddr::IP::InetBase::BEGIN@71 # spent 8µs making 1 call to warnings::unimport
- - |  |  |  |  |
73 | 1 | 1µs |  |  |
- - |  |  |  |  |
77 | 1 | 84µs |  |  |
- - |  |  |  |  |
79 | 1 | 1µs |  |  |
- - |  |  |  |  |
81 | 2 | 5µs | 1 | 414µs | # spent 414µs making 1 call to AutoLoader::AUTOLOAD
- - |  |  |  |  |
85 | 2 | 94µs |  |  |
86 | 1 | 4µs | 1 | 170µs | # spent 170µs making 1 call to Exporter::import
- - |  |  |  |  |
90 | 1 | 2µs |  |  |
- - |  |  |  |  |
93 | 1 | 400ns |  |  |
- - |  |  |  |  |
109 |  |  |  |  |
- - |  |  |  |  |
119 |  |  |  |  |
- - |  |  |  |  |
124 |  |  |  |  | # spent 6µs within NetAddr::IP::InetBase::BEGIN@124 which was called: # once (6µs+0s) by NetAddr::IP::Lite::BEGIN@9 at line 128
125 | 2 | 59µs | 2 | 73µs | # spent 42µs (10+31) within NetAddr::IP::InetBase::BEGIN@125 which was called: # once (10µs+31µs) by NetAddr::IP::Lite::BEGIN@9 at line 125 # spent 42µs making 1 call to NetAddr::IP::InetBase::BEGIN@125 # spent 31µs making 1 call to vars::import
126 | 1 | 600ns |  |  |
127 | 1 | 6µs |  |  |
128 | 1 | 740µs | 1 | 6µs | # spent 6µs making 1 call to NetAddr::IP::InetBase::BEGIN@124
- - |  |  |  |  |
130 | 1 | 200ns |  |  |
- - |  |  |  |  |
132 | 3 | 12µs |  |  | # spent 6µs within NetAddr::IP::InetBase::upper which was called: # once (6µs+0s) by NetAddr::IP::InetBase::import at line 274
133 |  |  |  |  |
- - |  |  |  |  |
135 |  |  |  |  |
- - |  |  |  |  |
141 |  |  |  |  |
- - |  |  |  |  |
167 |  |  |  |  | # spent 401ms (350+51.8) within NetAddr::IP::InetBase::fillIPv4 which was called 47822 times, avg 8µs/call: # 47822 times (350ms+51.8ms) by NetAddr::IP::InetBase::inet_aton at line 206, avg 8µs/call
168 | 47822 | 12.6ms |  |  |
169 | 47822 | 6.05ms |  |  |
170 | 47822 | 153ms | 47822 | 51.8ms | # spent 51.8ms making 47822 calls to NetAddr::IP::InetBase::CORE:match, avg 1µs/call
171 | 47822 | 39.2ms |  |  |
- - |  |  |  |  |
173 | 47822 | 91.5ms |  |  |
- - |  |  |  |  |
177 | 47822 | 54.0ms |  |  |
- - |  |  |  |  |
202 | 47822 | 115ms |  |  |
- - |  |  |  |  |
205 |  |  |  |  | # spent 946ms (316+630) within NetAddr::IP::InetBase::inet_aton which was called 47822 times, avg 20µs/call: # 47820 times (316ms+630ms) by NetAddr::IP::Lite::_xnew at line 1042 of NetAddr/IP/Lite.pm, avg 20µs/call # once (12µs+52µs) by NetAddr::IP::BEGIN@8 at line 648 of NetAddr/IP/Lite.pm # once (5µs+16µs) by NetAddr::IP::BEGIN@8 at line 651 of NetAddr/IP/Lite.pm
206 | 47822 | 55.4ms | 47822 | 401ms | # spent 401ms making 47822 calls to NetAddr::IP::InetBase::fillIPv4, avg 8µs/call
207 | 47822 | 465ms | 47822 | 229ms | # spent 229ms making 47822 calls to NetAddr::IP::InetBase::CORE:ghbyname, avg 5µs/call
- - |  |  |  |  |
244 | 1 | 300ns | 1 | 11µs | # spent 11µs making 1 call to main::CORE:pack
245 | 1 | 200ns | 1 | 900ns | # spent 900ns making 1 call to main::CORE:pack
- - |  |  |  |  |
247 |  |  |  |  |
- - |  |  |  |  |
256 | 1 | 200ns | 1 | 2µs | # spent 2µs making 1 call to main::CORE:pack
- - |  |  |  |  |
258 |  |  |  |  |
- - |  |  |  |  |
263 |  |  |  |  |
- - |  |  |  |  |
270 |  |  |  |  |
- - |  |  |  |  |
272 |  |  |  |  | # spent 352µs (26+325) within NetAddr::IP::InetBase::import which was called 2 times, avg 176µs/call: # once (16µs+182µs) by NetAddr::IP::Util::BEGIN@11 at line 11 of NetAddr/IP/Util.pm # once (10µs+144µs) by NetAddr::IP::Lite::BEGIN@9 at line 9 of NetAddr/IP/Lite.pm
273 | 2 | 3µs |  |  |
274 | 1 | 900ns | 1 | 6µs | # spent 6µs making 1 call to NetAddr::IP::InetBase::upper
275 | 1 | 2µs |  |  |
- - |  |  |  |  |
277 | 2 | 10µs | 2 | 27µs | # spent 27µs making 2 calls to Exporter::export_to_level, avg 14µs/call
- - |  |  |  |  |
280 | 1 | 20µs |  |  |
- - |  |  |  |  |
406 |  |  |  |  | # spent 158µs (126+32) within NetAddr::IP::InetBase::ipv6_aton which was called 3 times, avg 53µs/call: # 2 times (70µs+18µs) by NetAddr::IP::InetBase::inet_any2n at line 490, avg 44µs/call # once (56µs+14µs) by NetAddr::IP::InetBase::inet_any2n at line 24 of AutoLoader.pm sub ipv6_aton {
407 | 3 | 1µs |  |  | my($ipv6) = @_;
408 | 3 | 300ns |  |  | return undef unless $ipv6;
409 | 3 | 7µs |  |  | local($1,$2,$3,$4,$5);
410 | 3 | 13µs | 3 | 6µs | if ($ipv6 =~ /^(.*:)(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) { # mixed hex, dot-quad # spent 6µs making 3 calls to NetAddr::IP::InetBase::CORE:match, avg 2µs/call
411 | 2 | 4µs |  |  | return undef if $2 > 255 || $3 > 255 || $4 > 255 || $5 > 255;
412 | 2 | 6µs |  |  | $ipv6 = sprintf("%s%X%02X:%X%02X",$1,$2,$3,$4,$5); # convert to pure hex
413 |  |  |  |  | }
414 | 3 | 300ns |  |  | my $c;
415 |  |  |  |  | return undef if
416 | 3 | 27µs | 12 | 9µs | $ipv6 =~ /[^:0-9a-fA-F]/ || # non-hex character # spent 5µs making 9 calls to NetAddr::IP::InetBase::CORE:match, avg 567ns/call # spent 4µs making 3 calls to NetAddr::IP::InetBase::CORE:subst, avg 1µs/call
417 |  |  |  |  | (($c = $ipv6) =~ s/::/x/ && $c =~ /(?:x|:):/) || # double :: ::?
418 |  |  |  |  | $ipv6 =~ /[0-9a-fA-F]{5,}/; # more than 4 digits
419 | 3 | 6µs |  |  | $c = $ipv6 =~ tr/:/:/; # count the colons
420 | 3 | 10µs | 3 | 1µs | return undef if $c < 7 && $ipv6 !~ /::/; # spent 1µs making 3 calls to NetAddr::IP::InetBase::CORE:match, avg 367ns/call
421 | 3 | 500ns |  |  | if ($c > 7) { # strip leading or trailing ::
422 |  |  |  |  | return undef unless
423 |  |  |  |  | $ipv6 =~ s/^::/:/ ||
424 |  |  |  |  | $ipv6 =~ s/::$/:/;
425 |  |  |  |  | return undef if --$c > 7;
426 |  |  |  |  | }
427 | 3 | 2µs |  |  | while ($c++ < 7) { # expand compressed fields
428 | 13 | 35µs | 13 | 12µs | $ipv6 =~ s/::/:::/; # spent 12µs making 13 calls to NetAddr::IP::InetBase::CORE:subst, avg 954ns/call
429 |  |  |  |  | }
430 | 3 | 6µs | 3 | 900ns | $ipv6 .= 0 if $ipv6 =~ /:$/; # spent 900ns making 3 calls to NetAddr::IP::InetBase::CORE:match, avg 300ns/call
431 | 3 | 8µs |  |  | my @hex = split(/:/,$ipv6);
432 | 3 | 3µs |  |  | foreach(0..$#hex) {
433 | 24 | 11µs |  |  | $hex[$_] = hex($hex[$_] || 0);
434 |  |  |  |  | }
435 | 3 | 24µs | 3 | 3µs | pack("n8",@hex); # spent 3µs making 3 calls to NetAddr::IP::InetBase::CORE:pack, avg 933ns/call
436 |  |  |  |  | }
437 |  |  |  |  |
438 |  |  |  |  | # end of NetAddr::IP::InetBase::ipv6_aton
439 | 1 | 2µs |  |  | 1;
440 |  |  |  |  |
- - |  |  |  |  |
485 |  |  |  |  | # spent 584µs (23+561) within NetAddr::IP::InetBase::inet_any2n which was called 3 times, avg 195µs/call: # once (11µs+471µs) by NetAddr::IP::BEGIN@8 at line 24 of AutoLoader.pm # once (8µs+50µs) by NetAddr::IP::BEGIN@8 at line 650 of NetAddr/IP/Lite.pm # once (4µs+40µs) by NetAddr::IP::BEGIN@8 at line 653 of NetAddr/IP/Lite.pm sub inet_any2n($) {
486 | 3 | 2µs |  |  | my($addr) = @_;
487 | 3 | 400ns |  |  | $addr = '' unless $addr;
488 | 3 | 9µs | 3 | 2µs | $addr = '::' . $addr # spent 2µs making 3 calls to NetAddr::IP::InetBase::CORE:match, avg 633ns/call
489 |  |  |  |  | unless $addr =~ /:/;
490 | 3 | 13µs | 3 | 489µs | return ipv6_aton($addr); # spent 401µs making 1 call to AutoLoader::AUTOLOAD # spent 88µs making 2 calls to NetAddr::IP::InetBase::ipv6_aton, avg 44µs/call
491 |  |  |  |  | }
492 |  |  |  |  |
493 |  |  |  |  | # end of NetAddr::IP::InetBase::inet_any2n
494 | 1 | 2µs |  |  | 1;
|  |  |  |  | # spent 229ms within NetAddr::IP::InetBase::CORE:ghbyname which was called 47822 times, avg 5µs/call: # 47822 times (229ms+0s) by NetAddr::IP::InetBase::inet_aton at line 207, avg 5µs/call sub NetAddr::IP::InetBase::CORE:ghbyname; # opcode
|  |  |  |  | # spent 51.8ms within NetAddr::IP::InetBase::CORE:match which was called 47844 times, avg 1µs/call: # 47822 times (51.8ms+0s) by NetAddr::IP::InetBase::fillIPv4 at line 170, avg 1µs/call # 9 times (5µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 416, avg 567ns/call # 3 times (6µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 410, avg 2µs/call # 3 times (2µs+0s) by NetAddr::IP::InetBase::inet_any2n at line 488, avg 633ns/call # 3 times (1µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 420, avg 367ns/call # 3 times (900ns+0s) by NetAddr::IP::InetBase::ipv6_aton at line 430, avg 300ns/call # once (4µs+0s) by NetAddr::IP::Lite::BEGIN@9 at line 14 sub NetAddr::IP::InetBase::CORE:match; # opcode
|  |  |  |  | # spent 3µs within NetAddr::IP::InetBase::CORE:pack which was called 3 times, avg 933ns/call: # 3 times (3µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 435, avg 933ns/call sub NetAddr::IP::InetBase::CORE:pack; # opcode
|  |  |  |  | # spent 16µs within NetAddr::IP::InetBase::CORE:subst which was called 16 times, avg 1µs/call: # 13 times (12µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 428, avg 954ns/call # 3 times (4µs+0s) by NetAddr::IP::InetBase::ipv6_aton at line 416, avg 1µs/call sub NetAddr::IP::InetBase::CORE:subst; # opcode