← Index
NYTProf Performance Profile   « block view • line view • sub view »
For script/nytprof.pl
  Run on Thu May 31 16:49:15 2012
Reported on Thu May 31 16:51:57 2012

Filename/Users/edenc/perl5/lib/perl5/AutoLoader.pm
StatementsExecuted 73 statements in 2.37ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
331746µs791µsAutoLoader::::importAutoLoader::import
111539µs600µsAutoLoader::::AUTOLOADAutoLoader::AUTOLOAD
11132µs60µsAutoLoader::::find_filenameAutoLoader::find_filename
22129µs29µsAutoLoader::::CORE:regcompAutoLoader::CORE:regcomp (opcode)
11123µs23µsAutoLoader::::BEGIN@4AutoLoader::BEGIN@4
64121µs21µsAutoLoader::::CORE:substAutoLoader::CORE:subst (opcode)
11113µs16µsAutoLoader::::BEGIN@3AutoLoader::BEGIN@3
11110µs10µsAutoLoader::::CORE:ftereadAutoLoader::CORE:fteread (opcode)
4319µs9µsAutoLoader::::CORE:matchAutoLoader::CORE:match (opcode)
1118µs19µsAutoLoader::::BEGIN@138AutoLoader::BEGIN@138
1118µs23µsAutoLoader::::BEGIN@30AutoLoader::BEGIN@30
1118µs18µsAutoLoader::::BEGIN@186AutoLoader::BEGIN@186
1117µs7µsAutoLoader::::BEGIN@13AutoLoader::BEGIN@13
4215µs5µsAutoLoader::::CORE:substcontAutoLoader::CORE:substcont (opcode)
0000s0sAutoLoader::::__ANON__[:31]AutoLoader::__ANON__[:31]
0000s0sAutoLoader::::unimportAutoLoader::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package AutoLoader;
2
3230µs218µs
# spent 16µs (13+3) within AutoLoader::BEGIN@3 which was called: # once (13µs+3µs) by Graph::MSTHeapElem::BEGIN@5 at line 3
use strict;
# spent 16µs making 1 call to AutoLoader::BEGIN@3 # spent 3µs making 1 call to strict::import
42116µs123µs
# spent 23µs within AutoLoader::BEGIN@4 which was called: # once (23µs+0s) by Graph::MSTHeapElem::BEGIN@5 at line 4
use 5.006_001;
# spent 23µs making 1 call to AutoLoader::BEGIN@4
5
61100nsour($VERSION, $AUTOLOAD);
7
81100nsmy $is_dosish;
910smy $is_epoc;
1010smy $is_vms;
1110smy $is_macos;
12
13
# spent 7µs within AutoLoader::BEGIN@13 which was called: # once (7µs+0s) by Graph::MSTHeapElem::BEGIN@5 at line 19
BEGIN {
1457µs $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare';
15 $is_epoc = $^O eq 'epoc';
16 $is_vms = $^O eq 'VMS';
17 $is_macos = $^O eq 'MacOS';
18 $VERSION = '5.72';
19179µs17µs}
# spent 7µs making 1 call to AutoLoader::BEGIN@13
20
21
# spent 600µs (539+60) within AutoLoader::AUTOLOAD which was called: # once (539µs+60µs) by POSIX::import at line 43 of POSIX.pm
AUTOLOAD {
22821µs my $sub = $AUTOLOAD;
23160µs my $filename = AutoLoader::find_filename( $sub );
# spent 60µs making 1 call to AutoLoader::find_filename
24
25 my $save = $@;
26 local $!; # Do not munge the value.
272518µs eval { local $SIG{__DIE__}; require $filename };
28 if ($@) {
29 if (substr($sub,-9) eq '::DESTROY') {
302488µs239µs
# spent 23µs (8+16) within AutoLoader::BEGIN@30 which was called: # once (8µs+16µs) by Graph::MSTHeapElem::BEGIN@5 at line 30
no strict 'refs';
# spent 23µs making 1 call to AutoLoader::BEGIN@30 # spent 16µs making 1 call to strict::unimport
31 *$sub = sub {};
32 $@ = undef;
33 } elsif ($@ =~ /^Can't locate/) {
34 # The load might just have failed because the filename was too
35 # long for some old SVR3 systems which treat long names as errors.
36 # If we can successfully truncate a long name then it's worth a go.
37 # There is a slight risk that we could pick up the wrong file here
38 # but autosplit should have warned about that when splitting.
39 if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
40 eval { local $SIG{__DIE__}; require $filename };
41 }
42 }
43 if ($@){
44 $@ =~ s/ at .*\n//;
45 my $error = $@;
46 require Carp;
47 Carp::croak($error);
48 }
49 }
50 $@ = $save;
511531µs goto &$sub;
# spent 531µs making 1 call to POSIX::load_imports
52}
53
54
# spent 60µs (32+29) within AutoLoader::find_filename which was called: # once (32µs+29µs) by AutoLoader::AUTOLOAD at line 23
sub find_filename {
5545µs my $sub = shift;
56 my $filename;
57 # Braces used to preserve $1 et al.
58 {
59 # Try to find the autoloaded file from the package-qualified
60 # name of the sub. e.g., if the sub needed is
61 # Getopt::Long::GetOptions(), then $INC{Getopt/Long.pm} is
62 # something like '/usr/lib/perl5/Getopt/Long.pm', and the
63 # autoload file is '/usr/lib/perl5/auto/Getopt/Long/GetOptions.al'.
64 #
65 # However, if @INC is a relative path, this might not work. If,
66 # for example, @INC = ('lib'), then $INC{Getopt/Long.pm} is
67 # 'lib/Getopt/Long.pm', and we want to require
68 # 'auto/Getopt/Long/GetOptions.al' (without the leading 'lib').
69 # In this case, we simple prepend the 'auto/' and let the
70 # C<require> take care of the searching for us.
71
72412µs13µs my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/);
# spent 3µs making 1 call to AutoLoader::CORE:match
731600ns $pkg =~ s#::#/#g;
# spent 600ns making 1 call to AutoLoader::CORE:subst
74215µs if (defined($filename = $INC{"$pkg.pm"})) {
75125µs if ($is_macos) {
76 $pkg =~ tr#/#:#;
77 $filename = undef
78 unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s;
79 } else {
80414µs $filename = undef
# spent 10µs making 1 call to AutoLoader::CORE:regcomp # spent 2µs making 1 call to AutoLoader::CORE:subst # spent 2µs making 2 calls to AutoLoader::CORE:substcont, avg 900ns/call
81 unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg/$func.al#s;
82 }
83
84 # if the file exists, then make sure that it is a
85 # a fully anchored path (i.e either '/usr/lib/auto/foo/bar.al',
86 # or './lib/auto/foo/bar.al'. This avoids C<require> searching
87 # (and failing) to find the 'lib/auto/foo/bar.al' because it
88 # looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib').
89
9014µs110µs if (defined $filename and -r $filename) {
# spent 10µs making 1 call to AutoLoader::CORE:fteread
9111µs unless ($filename =~ m|^/|s) {
# spent 1µs making 1 call to AutoLoader::CORE:match
92 if ($is_dosish) {
93 unless ($filename =~ m{^([a-z]:)?[\\/]}is) {
94 if ($^O ne 'NetWare') {
95 $filename = "./$filename";
96 } else {
97 $filename = "$filename";
98 }
99 }
100 }
101 elsif ($is_epoc) {
102 unless ($filename =~ m{^([a-z?]:)?[\\/]}is) {
103 $filename = "./$filename";
104 }
105 }
106 elsif ($is_vms) {
107 # XXX todo by VMSmiths
108 $filename = "./$filename";
109 }
110 elsif (!$is_macos) {
111 $filename = "./$filename";
112 }
113 }
114 }
115 else {
116 $filename = undef;
117 }
118 }
119 unless (defined $filename) {
120 # let C<require> do the searching
121 $filename = "auto/$sub.al";
122 $filename =~ s#::#/#g;
123 }
124 }
125 return $filename;
126}
127
128
# spent 791µs (746+45) within AutoLoader::import which was called 3 times, avg 264µs/call: # once (719µs+36µs) by POSIX::BEGIN@9 at line 9 of POSIX.pm # once (17µs+6µs) by POSIX::SigAction::BEGIN@52 at line 52 of POSIX.pm # once (10µs+4µs) by POSIX::SigRt::BEGIN@56 at line 56 of POSIX.pm
sub import {
1291837µs my $pkg = shift;
130 my $callpkg = caller;
131
132 #
133 # Export symbols, but not by accident of inheritance.
134 #
135
136315µs if ($pkg eq 'AutoLoader') {
13725µs25µs if ( @_ and $_[0] =~ /^&?AUTOLOAD$/ ) {
# spent 5µs making 2 calls to AutoLoader::CORE:match, avg 2µs/call
1382182µs230µs
# spent 19µs (8+11) within AutoLoader::BEGIN@138 which was called: # once (8µs+11µs) by Graph::MSTHeapElem::BEGIN@5 at line 138
no strict 'refs';
# spent 19µs making 1 call to AutoLoader::BEGIN@138 # spent 11µs making 1 call to strict::unimport
139 *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD;
140 }
141 }
142
143 #
144 # Try to find the autosplit index file. Eg., if the call package
145 # is POSIX, then $INC{POSIX.pm} is something like
146 # '/usr/local/lib/perl5/POSIX.pm', and the autosplit index file is in
147 # '/usr/local/lib/perl5/auto/POSIX/autosplit.ix', so we require that.
148 #
149 # However, if @INC is a relative path, this might not work. If,
150 # for example, @INC = ('lib'), then
151 # $INC{POSIX.pm} is 'lib/POSIX.pm', and we want to require
152 # 'auto/POSIX/autosplit.ix' (without the leading 'lib').
153 #
154
15536µs (my $calldir = $callpkg) =~ s#::#/#g;
# spent 6µs making 3 calls to AutoLoader::CORE:subst, avg 2µs/call
156 my $path = $INC{$calldir . '.pm'};
157512µs if (defined($path)) {
158 # Try absolute path name, but only eval it if the
159 # transformation from module path to autosplit.ix path
160 # succeeded!
161 my $replaced_okay;
162168µs if ($is_macos) {
163 (my $malldir = $calldir) =~ tr#/#:#;
164 $replaced_okay = ($path =~ s#^(.*)$malldir\.pm\z#$1auto:$malldir:autosplit.ix#s);
165 } else {
166434µs $replaced_okay = ($path =~ s#^(.*)$calldir\.pm\z#$1auto/$calldir/autosplit.ix#);
# spent 19µs making 1 call to AutoLoader::CORE:regcomp # spent 12µs making 1 call to AutoLoader::CORE:subst # spent 3µs making 2 calls to AutoLoader::CORE:substcont, avg 2µs/call
167 }
168
1691654µs eval { require $path; } if $replaced_okay;
170 # If that failed, try relative path with normal @INC searching.
171 if (!$replaced_okay or $@) {
172 $path ="auto/$calldir/autosplit.ix";
173 eval { require $path; };
174 }
175 if ($@) {
176 my $error = $@;
177 require Carp;
178 Carp::carp($error);
179 }
180 }
181}
182
183sub unimport {
184 my $callpkg = caller;
185
186278µs228µs
# spent 18µs (8+10) within AutoLoader::BEGIN@186 which was called: # once (8µs+10µs) by Graph::MSTHeapElem::BEGIN@5 at line 186
no strict 'refs';
# spent 18µs making 1 call to AutoLoader::BEGIN@186 # spent 10µs making 1 call to strict::unimport
187
188 for my $exported (qw( AUTOLOAD )) {
189 my $symname = $callpkg . '::' . $exported;
190 undef *{ $symname } if \&{ $symname } == \&{ $exported };
191 *{ $symname } = \&{ $symname };
192 }
193}
194
19515µs1;
196
197__END__
 
# spent 10µs within AutoLoader::CORE:fteread which was called: # once (10µs+0s) by AutoLoader::find_filename at line 90
sub AutoLoader::CORE:fteread; # opcode
# spent 9µs within AutoLoader::CORE:match which was called 4 times, avg 2µs/call: # 2 times (5µs+0s) by AutoLoader::import at line 137, avg 2µs/call # once (3µs+0s) by AutoLoader::find_filename at line 72 # once (1µs+0s) by AutoLoader::find_filename at line 91
sub AutoLoader::CORE:match; # opcode
# spent 29µs within AutoLoader::CORE:regcomp which was called 2 times, avg 14µs/call: # once (19µs+0s) by AutoLoader::import at line 166 # once (10µs+0s) by AutoLoader::find_filename at line 80
sub AutoLoader::CORE:regcomp; # opcode
# spent 21µs within AutoLoader::CORE:subst which was called 6 times, avg 3µs/call: # 3 times (6µs+0s) by AutoLoader::import at line 155, avg 2µs/call # once (12µs+0s) by AutoLoader::import at line 166 # once (2µs+0s) by AutoLoader::find_filename at line 80 # once (600ns+0s) by AutoLoader::find_filename at line 73
sub AutoLoader::CORE:subst; # opcode
# spent 5µs within AutoLoader::CORE:substcont which was called 4 times, avg 1µs/call: # 2 times (3µs+0s) by AutoLoader::import at line 166, avg 2µs/call # 2 times (2µs+0s) by AutoLoader::find_filename at line 80, avg 900ns/call
sub AutoLoader::CORE:substcont; # opcode