| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Sub/Identify.pm |
| Statements | Executed 846 statements in 25.3ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 825 | 1 | 1 | 16.2ms | 21.8ms | Sub::Identify::sub_fullname |
| 825 | 1 | 1 | 5.56ms | 5.56ms | Sub::Identify::get_code_info (xsub) |
| 1 | 1 | 1 | 126µs | 709µs | Sub::Identify::BEGIN@6 |
| 1 | 1 | 1 | 72µs | 89µs | Sub::Identify::BEGIN@3 |
| 1 | 1 | 1 | 42µs | 202µ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_name |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Sub::Identify; | ||||
| 2 | |||||
| 3 | 3 | 98µs | 2 | 107µs | # spent 89µs (72+18) within Sub::Identify::BEGIN@3 which was called:
# once (72µs+18µs) by namespace::clean::BEGIN@15 at line 3 # spent 89µs making 1 call to Sub::Identify::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 1.01ms | 2 | 362µs | # spent 202µs (42+160) within Sub::Identify::BEGIN@4 which was called:
# once (42µs+160µs) by namespace::clean::BEGIN@15 at line 4 # spent 202µs making 1 call to Sub::Identify::BEGIN@4
# spent 160µs making 1 call to Exporter::import |
| 5 | |||||
| 6 | # spent 709µs (126+583) within Sub::Identify::BEGIN@6 which was called:
# once (126µs+583µs) by namespace::clean::BEGIN@15 at line 46 | ||||
| 7 | 7 | 71µs | our $VERSION = '0.04'; | ||
| 8 | our @ISA = ('Exporter'); | ||||
| 9 | our %EXPORT_TAGS = (all => [ our @EXPORT_OK = qw(sub_name stash_name sub_fullname get_code_info) ]); | ||||
| 10 | |||||
| 11 | my $loaded = 0; | ||||
| 12 | 4 | 14µs | unless ($ENV{PERL_SUB_IDENTIFY_PP}) { | ||
| 13 | local $@; | ||||
| 14 | 1 | 8µs | eval { | ||
| 15 | 2 | 615µs | if ($] >= 5.006) { | ||
| 16 | require XSLoader; | ||||
| 17 | 1 | 583µs | XSLoader::load(__PACKAGE__, $VERSION); # spent 583µ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 | die $@ if $@ && $@ !~ /object version|loadable object/; | ||||
| 27 | |||||
| 28 | $loaded = 1 unless $@; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | our $IsPurePerl = !$loaded; | ||||
| 32 | |||||
| 33 | 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 | 357µs | 1 | 709µs | } # spent 709µ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 | 825 | 23.1ms | 825 | 5.56ms | # spent 21.8ms (16.2+5.56) within Sub::Identify::sub_fullname which was called 825 times, avg 26µs/call:
# 825 times (16.2ms+5.56ms) by namespace::clean::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/namespace/clean.pm:52] at line 43 of namespace/clean.pm, avg 26µs/call # spent 5.56ms making 825 calls to Sub::Identify::get_code_info, avg 7µs/call |
| 51 | |||||
| 52 | 1 | 9µs | 1; | ||
| 53 | |||||
| 54 | __END__ | ||||
# spent 5.56ms within Sub::Identify::get_code_info which was called 825 times, avg 7µs/call:
# 825 times (5.56ms+0s) by Sub::Identify::sub_fullname at line 50, avg 7µs/call |