← Index
NYTProf Performance Profile   « line view »
For index.cgi
  Run on Sat May 9 17:18:47 2020
Reported on Sat May 9 17:19:07 2020

Filename/usr/local/lib/perl/5.18.2/Sub/Identify.pm
StatementsExecuted 33 statements in 1.17ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
161155µs75µsSub::Identify::::stash_nameSub::Identify::stash_name
11133µs239µsSub::Identify::::BEGIN@6Sub::Identify::BEGIN@6
161120µs20µsSub::Identify::::get_code_infoSub::Identify::get_code_info (xsub)
11115µs33µsSub::Identify::::BEGIN@3Sub::Identify::BEGIN@3
11112µs36µsSub::Identify::::BEGIN@4Sub::Identify::BEGIN@4
0000s0sSub::Identify::::__ANON__[:49]Sub::Identify::__ANON__[:49]
0000s0sSub::Identify::::__ANON__[:58]Sub::Identify::__ANON__[:58]
0000s0sSub::Identify::::__ANON__[:70]Sub::Identify::__ANON__[:70]
0000s0sSub::Identify::::sub_fullnameSub::Identify::sub_fullname
0000s0sSub::Identify::::sub_nameSub::Identify::sub_name
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Sub::Identify;
2
3240µs250µs
# spent 33µs (15+18) within Sub::Identify::BEGIN@3 which was called: # once (15µs+18µs) by namespace::autoclean::_method_check at line 3
use strict;
# spent 33µs making 1 call to Sub::Identify::BEGIN@3 # spent 18µs making 1 call to strict::import
42630µs260µs
# spent 36µs (12+24) within Sub::Identify::BEGIN@4 which was called: # once (12µs+24µs) by namespace::autoclean::_method_check at line 4
use Exporter;
# spent 36µs making 1 call to Sub::Identify::BEGIN@4 # spent 24µs making 1 call to Exporter::import
5
6
# spent 239µs (33+207) within Sub::Identify::BEGIN@6 which was called: # once (33µs+207µs) by namespace::autoclean::_method_check at line 72
BEGIN {
71800ns our $VERSION = '0.12';
817µs our @ISA = ('Exporter');
914µs our %EXPORT_TAGS = (
10 all => [
11 our @EXPORT_OK = qw(
12 sub_name
13 stash_name
14 sub_fullname
15 get_code_info
16 get_code_location
17 is_sub_constant
18 )
19 ]
20 );
21
221300ns our $IsPurePerl = 1;
231900ns unless ($ENV{PERL_SUB_IDENTIFY_PP}) {
2411µs if (
25 eval {
261600ns require XSLoader;
271216µs1207µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 207µs making 1 call to XSLoader::load
281900ns 1;
29 }
30 ) {
311500ns $IsPurePerl = 0;
32 }
33 else {
34 die $@ if $@ && $@ !~ /object version|loadable object/;
35 }
36 }
37
381300ns if ($IsPurePerl) {
39 require B;
40 *get_code_info = sub ($) {
41 my ($coderef) = @_;
42 ref $coderef or return;
43 my $cv = B::svref_2object($coderef);
44 $cv->isa('B::CV') or return;
45 # bail out if GV is undefined
46 $cv->GV->isa('B::SPECIAL') and return;
47
48 return ($cv->GV->STASH->NAME, $cv->GV->NAME);
49 };
50 *get_code_location = sub ($) {
51 my ($coderef) = @_;
52 ref $coderef or return;
53 my $cv = B::svref_2object($coderef);
54 $cv->isa('B::CV') && $cv->START->isa('B::COP')
55 or return;
56
57 return ($cv->START->file, $cv->START->line);
58 };
59 }
6015µs if ($IsPurePerl || $] < 5.016) {
61 require B;
62 *is_sub_constant = sub ($) {
63 my ($coderef) = @_;
64 ref $coderef or return 0;
65 my $cv = B::svref_2object($coderef);
66 $cv->isa('B::CV') or return 0;
67 my $p = prototype $coderef;
68 defined $p && $p eq "" or return 0;
69 return ($cv->CvFLAGS & B::CVf_CONST()) == B::CVf_CONST();
70 };
71 }
721163µs1239µs}
# spent 239µs making 1 call to Sub::Identify::BEGIN@6
73
741693µs1620µs
# spent 75µs (55+20) within Sub::Identify::stash_name which was called 16 times, avg 5µs/call: # 16 times (55µs+20µs) by namespace::autoclean::__ANON__[/usr/local/share/perl/5.18.2/namespace/autoclean.pm:210] at line 204 of namespace/autoclean.pm, avg 5µs/call
sub stash_name ($) { (get_code_info($_[0]))[0] }
# spent 20µs making 16 calls to Sub::Identify::get_code_info, avg 1µs/call
75sub sub_name ($) { (get_code_info($_[0]))[1] }
76sub sub_fullname ($) { join '::', get_code_info($_[0]) }
77
7813µs1;
79
80__END__
 
# spent 20µs within Sub::Identify::get_code_info which was called 16 times, avg 1µs/call: # 16 times (20µs+0s) by Sub::Identify::stash_name at line 74, avg 1µs/call
sub Sub::Identify::get_code_info; # xsub