| Filename | /usr/lib/perl5/Sub/Identify.pm |
| Statements | Executed 19 statements in 489µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 31µs | 144µs | Sub::Identify::BEGIN@6 |
| 1 | 1 | 1 | 8µs | 16µs | Sub::Identify::BEGIN@3 |
| 1 | 1 | 1 | 6µs | 18µs | Sub::Identify::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Sub::Identify::__ANON__[:44] |
| 0 | 0 | 0 | 0s | 0s | Sub::Identify::stash_name |
| 0 | 0 | 0 | 0s | 0s | Sub::Identify::sub_fullname |
| 0 | 0 | 0 | 0s | 0s | Sub::Identify::sub_name |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Sub::Identify; | ||||
| 2 | |||||
| 3 | 2 | 17µs | 2 | 24µs | # spent 16µs (8+8) within Sub::Identify::BEGIN@3 which was called:
# once (8µs+8µs) by Devel::OverloadInfo::BEGIN@18 at line 3 # spent 16µs making 1 call to Sub::Identify::BEGIN@3
# spent 8µs making 1 call to strict::import |
| 4 | 2 | 251µs | 2 | 30µs | # spent 18µs (6+12) within Sub::Identify::BEGIN@4 which was called:
# once (6µs+12µs) by Devel::OverloadInfo::BEGIN@18 at line 4 # spent 18µs making 1 call to Sub::Identify::BEGIN@4
# spent 12µs making 1 call to Exporter::import |
| 5 | |||||
| 6 | # spent 144µs (31+113) within Sub::Identify::BEGIN@6 which was called:
# once (31µs+113µs) by Devel::OverloadInfo::BEGIN@18 at line 46 | ||||
| 7 | 1 | 400ns | our $VERSION = '0.04'; | ||
| 8 | 1 | 6µs | our @ISA = ('Exporter'); | ||
| 9 | 1 | 2µs | our %EXPORT_TAGS = (all => [ our @EXPORT_OK = qw(sub_name stash_name sub_fullname get_code_info) ]); | ||
| 10 | |||||
| 11 | 1 | 300ns | my $loaded = 0; | ||
| 12 | 1 | 9µs | unless ($ENV{PERL_SUB_IDENTIFY_PP}) { | ||
| 13 | 1 | 300ns | local $@; | ||
| 14 | 1 | 2µs | eval { | ||
| 15 | 1 | 2µs | if ($] >= 5.006) { | ||
| 16 | 1 | 400ns | require XSLoader; | ||
| 17 | 1 | 118µs | 1 | 113µs | XSLoader::load(__PACKAGE__, $VERSION); # spent 113µs making 1 call to XSLoader::load |
| 18 | } | ||||
| 19 | else { | ||||
| 20 | require DynaLoader; | ||||
| 21 | push @ISA, 'DynaLoader'; | ||||
| 22 | __PACKAGE__->bootstrap($VERSION); | ||||
| 23 | } | ||||
| 24 | }; | ||||
| 25 | |||||
| 26 | 1 | 100ns | die $@ if $@ && $@ !~ /object version|loadable object/; | ||
| 27 | |||||
| 28 | 1 | 300ns | $loaded = 1 unless $@; | ||
| 29 | } | ||||
| 30 | |||||
| 31 | 1 | 400ns | our $IsPurePerl = !$loaded; | ||
| 32 | |||||
| 33 | 1 | 3µs | if ($IsPurePerl) { | ||
| 34 | require B; | ||||
| 35 | *get_code_info = sub ($) { | ||||
| 36 | my ($coderef) = @_; | ||||
| 37 | ref $coderef or return; | ||||
| 38 | my $cv = B::svref_2object($coderef); | ||||
| 39 | $cv->isa('B::CV') or return; | ||||
| 40 | # bail out if GV is undefined | ||||
| 41 | $cv->GV->isa('B::SPECIAL') and return; | ||||
| 42 | |||||
| 43 | return ($cv->GV->STASH->NAME, $cv->GV->NAME); | ||||
| 44 | }; | ||||
| 45 | } | ||||
| 46 | 1 | 76µs | 1 | 144µs | } # spent 144µs making 1 call to Sub::Identify::BEGIN@6 |
| 47 | |||||
| 48 | sub stash_name ($) { (get_code_info($_[0]))[0] } | ||||
| 49 | sub sub_name ($) { (get_code_info($_[0]))[1] } | ||||
| 50 | sub sub_fullname ($) { join '::', get_code_info($_[0]) } | ||||
| 51 | |||||
| 52 | 1 | 2µs | 1; | ||
| 53 | |||||
| 54 | __END__ |