← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Sub/Identify.pm
StatementsExecuted 17 statements in 471µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11118µs129µsSub::Identify::::BEGIN@6Sub::Identify::BEGIN@6
1117µs8µsSub::Identify::::BEGIN@3Sub::Identify::BEGIN@3
1114µs15µ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::::stash_nameSub::Identify::stash_name
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
3213µs29µs
# spent 8µs (7+1) within Sub::Identify::BEGIN@3 which was called: # once (7µs+1µs) by Devel::OverloadInfo::BEGIN@18 at line 3
use strict;
# spent 8µs making 1 call to Sub::Identify::BEGIN@3 # spent 1µs making 1 call to strict::import
42256µs225µs
# spent 15µs (4+11) within Sub::Identify::BEGIN@4 which was called: # once (4µs+11µs) by Devel::OverloadInfo::BEGIN@18 at line 4
use Exporter;
# spent 15µs making 1 call to Sub::Identify::BEGIN@4 # spent 11µs making 1 call to Exporter::import
5
6
# spent 129µs (18+111) within Sub::Identify::BEGIN@6 which was called: # once (18µs+111µs) by Devel::OverloadInfo::BEGIN@18 at line 72
BEGIN {
71200ns our $VERSION = '0.12';
814µs our @ISA = ('Exporter');
912µ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
221200ns our $IsPurePerl = 1;
231600ns unless ($ENV{PERL_SUB_IDENTIFY_PP}) {
241500ns if (
25 eval {
261400ns require XSLoader;
271116µs1111µs XSLoader::load(__PACKAGE__, $VERSION);
# spent 111µs making 1 call to XSLoader::load
281500ns 1;
29 }
30 ) {
311200ns $IsPurePerl = 0;
32 }
33 else {
34 die $@ if $@ && $@ !~ /object version|loadable object/;
35 }
36 }
37
381100ns 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 }
6013µ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 }
72173µs1129µs}
# spent 129µs making 1 call to Sub::Identify::BEGIN@6
73
74sub stash_name ($) { (get_code_info($_[0]))[0] }
75sub sub_name ($) { (get_code_info($_[0]))[1] }
76sub sub_fullname ($) { join '::', get_code_info($_[0]) }
77
7812µs1;
79
80__END__