Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/x86_64-linux/Sub/Identify.pm |
Statements | Executed 150 statements in 1.69ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
131 | 1 | 1 | 749µs | 988µs | sub_fullname | Sub::Identify::
131 | 1 | 1 | 239µs | 239µs | get_code_info (xsub) | Sub::Identify::
1 | 1 | 1 | 35µs | 202µs | BEGIN@6 | Sub::Identify::
1 | 1 | 1 | 24µs | 30µs | BEGIN@3 | Sub::Identify::
1 | 1 | 1 | 11µs | 42µs | BEGIN@4 | Sub::Identify::
0 | 0 | 0 | 0s | 0s | __ANON__[:44] | Sub::Identify::
0 | 0 | 0 | 0s | 0s | stash_name | Sub::Identify::
0 | 0 | 0 | 0s | 0s | sub_name | Sub::Identify::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Sub::Identify; | ||||
2 | |||||
3 | 2 | 26µs | 2 | 35µs | # spent 30µs (24+5) within Sub::Identify::BEGIN@3 which was called:
# once (24µs+5µs) by namespace::clean::BEGIN@15 at line 3 # spent 30µs making 1 call to Sub::Identify::BEGIN@3
# spent 5µs making 1 call to strict::import |
4 | 2 | 264µs | 2 | 73µs | # spent 42µs (11+31) within Sub::Identify::BEGIN@4 which was called:
# once (11µs+31µs) by namespace::clean::BEGIN@15 at line 4 # spent 42µs making 1 call to Sub::Identify::BEGIN@4
# spent 31µs making 1 call to Exporter::import |
5 | |||||
6 | # spent 202µs (35+168) within Sub::Identify::BEGIN@6 which was called:
# once (35µs+168µs) by namespace::clean::BEGIN@15 at line 46 | ||||
7 | 14 | 202µ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 | unless ($ENV{PERL_SUB_IDENTIFY_PP}) { | ||||
13 | local $@; | ||||
14 | eval { | ||||
15 | if ($] >= 5.006) { | ||||
16 | require XSLoader; | ||||
17 | 1 | 168µs | XSLoader::load(__PACKAGE__, $VERSION); # spent 168µ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 | 83µs | 1 | 202µs | } # spent 202µ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 | 131 | 1.11ms | 131 | 239µs | # spent 988µs (749+239) within Sub::Identify::sub_fullname which was called 131 times, avg 8µs/call:
# 131 times (749µs+239µs) by namespace::clean::__ANON__[/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/namespace/clean.pm:52] at line 43 of namespace/clean.pm, avg 8µs/call # spent 239µs making 131 calls to Sub::Identify::get_code_info, avg 2µs/call |
51 | |||||
52 | 1 | 3µs | 1; | ||
53 | |||||
54 | __END__ | ||||
# spent 239µs within Sub::Identify::get_code_info which was called 131 times, avg 2µs/call:
# 131 times (239µs+0s) by Sub::Identify::sub_fullname at line 50, avg 2µs/call |