← Index
NYTProf Performance Profile   « block view • line view • sub view »
For conv.pl
  Run on Sun Nov 14 21:14:18 2010
Reported on Sun Nov 14 21:17:54 2010

Filename/usr/share/perl/5.10/AutoLoader.pm
StatementsExecuted 92 statements in 4.24ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4421.31ms1.40msAutoLoader::::importAutoLoader::import
1111.20ms1.32msAutoLoader::::AUTOLOADAutoLoader::AUTOLOAD
11175µs126µsAutoLoader::::find_filenameAutoLoader::find_filename
32161µs61µsAutoLoader::::CORE:regcompAutoLoader::CORE:regcomp (opcode)
11133µs45µsAutoLoader::::BEGIN@3AutoLoader::BEGIN@3
11133µs33µsAutoLoader::::BEGIN@4AutoLoader::BEGIN@4
84130µs30µsAutoLoader::::CORE:substAutoLoader::CORE:subst (opcode)
11125µs25µsAutoLoader::::BEGIN@13AutoLoader::BEGIN@13
11119µs19µsAutoLoader::::CORE:ftereadAutoLoader::CORE:fteread (opcode)
11118µs45µsAutoLoader::::BEGIN@186AutoLoader::BEGIN@186
43116µs16µsAutoLoader::::CORE:matchAutoLoader::CORE:match (opcode)
11116µs47µsAutoLoader::::BEGIN@30AutoLoader::BEGIN@30
11115µs48µsAutoLoader::::BEGIN@138AutoLoader::BEGIN@138
62113µs13µ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
3346µs257µs
# spent 45µs (33+12) within AutoLoader::BEGIN@3 which was called: # once (33µs+12µs) by MARC::Charset::BEGIN@10 at line 3
use strict;
# spent 45µs making 1 call to AutoLoader::BEGIN@3 # spent 12µs making 1 call to strict::import
43173µs133µs
# spent 33µs within AutoLoader::BEGIN@4 which was called: # once (33µs+0s) by MARC::Charset::BEGIN@10 at line 4
use 5.006_001;
# spent 33µs making 1 call to AutoLoader::BEGIN@4
5
611µsour($VERSION, $AUTOLOAD);
7
811µsmy $is_dosish;
911µsmy $is_epoc;
1011µsmy $is_vms;
1111µsmy $is_macos;
12
13
# spent 25µs within AutoLoader::BEGIN@13 which was called: # once (25µs+0s) by MARC::Charset::BEGIN@10 at line 19
BEGIN {
1415µs $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare';
1512µs $is_epoc = $^O eq 'epoc';
1611µs $is_vms = $^O eq 'VMS';
1711µs $is_macos = $^O eq 'MacOS';
1818µs $VERSION = '5.68';
191108µs125µs}
# spent 25µs making 1 call to AutoLoader::BEGIN@13
20
21
# spent 1.32ms (1.20+126µs) within AutoLoader::AUTOLOAD which was called: # once (1.20ms+126µs) by POSIX::import at line 44 of POSIX.pm
AUTOLOAD {
2212µs my $sub = $AUTOLOAD;
2316µs1126µs my $filename = AutoLoader::find_filename( $sub );
# spent 126µs making 1 call to AutoLoader::find_filename
24
2511µs my $save = $@;
261163µs local $!; # Do not munge the value.
2731.00ms eval { local $SIG{__DIE__}; require $filename };
2811µs if ($@) {
29 if (substr($sub,-9) eq '::DESTROY') {
303744µs278µs
# spent 47µs (16+31) within AutoLoader::BEGIN@30 which was called: # once (16µs+31µs) by MARC::Charset::BEGIN@10 at line 30
no strict 'refs';
# spent 47µs making 1 call to AutoLoader::BEGIN@30 # spent 31µ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 }
5011µs $@ = $save;
51115µs1779µs goto &$sub;
# spent 779µs making 1 call to POSIX::load_imports
52}
53
54
# spent 126µs (75+51) within AutoLoader::find_filename which was called: # once (75µs+51µs) by AutoLoader::AUTOLOAD at line 23
sub find_filename {
5511µs my $sub = shift;
5611µs 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
72214µs15µs my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/);
# spent 5µs making 1 call to AutoLoader::CORE:match
7317µs11µs $pkg =~ s#::#/#g;
# spent 1µs making 1 call to AutoLoader::CORE:subst
7414µs if (defined($filename = $INC{"$pkg.pm"})) {
7512µs if ($is_macos) {
76 $pkg =~ tr#/#:#;
77 $filename = undef
78 unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s;
79 } else {
80144µs423µs $filename = undef
# spent 15µs making 1 call to AutoLoader::CORE:regcomp # spent 4µs making 1 call to AutoLoader::CORE:subst # spent 4µs making 2 calls to AutoLoader::CORE:substcont, avg 2µs/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
90139µs119µs if (defined $filename and -r $filename) {
# spent 19µs making 1 call to AutoLoader::CORE:fteread
9118µs13µs unless ($filename =~ m|^/|s) {
# spent 3µ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 }
11912µs unless (defined $filename) {
120 # let C<require> do the searching
121 $filename = "auto/$sub.al";
122 $filename =~ s#::#/#g;
123 }
124 }
125113µs return $filename;
126}
127
128
# spent 1.40ms (1.31+88µs) within AutoLoader::import which was called 4 times, avg 349µs/call: # once (987µs+35µs) by POSIX::BEGIN@9 at line 9 of POSIX.pm # once (255µs+38µs) by Storable::BEGIN@22 at line 22 of Storable.pm # once (39µs+10µs) by POSIX::SigAction::BEGIN@58 at line 58 of POSIX.pm # once (27µs+5µs) by POSIX::SigRt::BEGIN@62 at line 62 of POSIX.pm
sub import {
12946µs my $pkg = shift;
13047µs my $callpkg = caller;
131
132 #
133 # Export symbols, but not by accident of inheritance.
134 #
135
13649µs if ($pkg eq 'AutoLoader') {
137426µs28µs if ( @_ and $_[0] =~ /^&?AUTOLOAD$/ ) {
# spent 8µs making 2 calls to AutoLoader::CORE:match, avg 4µs/call
1383316µs281µs
# spent 48µs (15+33) within AutoLoader::BEGIN@138 which was called: # once (15µs+33µs) by MARC::Charset::BEGIN@10 at line 138
no strict 'refs';
# spent 48µs making 1 call to AutoLoader::BEGIN@138 # spent 33µs making 1 call to strict::unimport
139218µs *{ $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
155438µs412µs (my $calldir = $callpkg) =~ s#::#/#g;
# spent 12µs making 4 calls to AutoLoader::CORE:subst, avg 3µs/call
15649µs my $path = $INC{$calldir . '.pm'};
157430µ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!
16122µs my $replaced_okay;
16226µs if ($is_macos) {
163 (my $malldir = $calldir) =~ tr#/#:#;
164 $replaced_okay = ($path =~ s#^(.*)$malldir\.pm\z#$1auto:$malldir:autosplit.ix#s);
165 } else {
1662113µs868µs $replaced_okay = ($path =~ s#^(.*)$calldir\.pm\z#$1auto/$calldir/autosplit.ix#);
# spent 46µs making 2 calls to AutoLoader::CORE:regcomp, avg 23µs/call # spent 13µs making 2 calls to AutoLoader::CORE:subst, avg 7µs/call # spent 9µs making 4 calls to AutoLoader::CORE:substcont, avg 2µs/call
167 }
168
16941.13ms eval { require $path; } if $replaced_okay;
170 # If that failed, try relative path with normal @INC searching.
17123µs if (!$replaced_okay or $@) {
172 $path ="auto/$calldir/autosplit.ix";
173 eval { require $path; };
174 }
17523µs if ($@) {
176 my $error = $@;
177 require Carp;
178 Carp::carp($error);
179 }
180 }
181}
182
183sub unimport {
184 my $callpkg = caller;
185
1863103µs272µs
# spent 45µs (18+27) within AutoLoader::BEGIN@186 which was called: # once (18µs+27µs) by MARC::Charset::BEGIN@10 at line 186
no strict 'refs';
# spent 45µs making 1 call to AutoLoader::BEGIN@186 # spent 27µ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
19516µs1;
196
197__END__
 
# spent 19µs within AutoLoader::CORE:fteread which was called: # once (19µs+0s) by AutoLoader::find_filename at line 90
sub AutoLoader::CORE:fteread; # opcode
# spent 16µs within AutoLoader::CORE:match which was called 4 times, avg 4µs/call: # 2 times (8µs+0s) by AutoLoader::import at line 137, avg 4µs/call # once (5µs+0s) by AutoLoader::find_filename at line 72 # once (3µs+0s) by AutoLoader::find_filename at line 91
sub AutoLoader::CORE:match; # opcode
# spent 61µs within AutoLoader::CORE:regcomp which was called 3 times, avg 20µs/call: # 2 times (46µs+0s) by AutoLoader::import at line 166, avg 23µs/call # once (15µs+0s) by AutoLoader::find_filename at line 80
sub AutoLoader::CORE:regcomp; # opcode
# spent 30µs within AutoLoader::CORE:subst which was called 8 times, avg 4µs/call: # 4 times (12µs+0s) by AutoLoader::import at line 155, avg 3µs/call # 2 times (13µs+0s) by AutoLoader::import at line 166, avg 7µs/call # once (4µs+0s) by AutoLoader::find_filename at line 80 # once (1µs+0s) by AutoLoader::find_filename at line 73
sub AutoLoader::CORE:subst; # opcode
# spent 13µs within AutoLoader::CORE:substcont which was called 6 times, avg 2µs/call: # 4 times (9µs+0s) by AutoLoader::import at line 166, avg 2µs/call # 2 times (4µs+0s) by AutoLoader::find_filename at line 80, avg 2µs/call
sub AutoLoader::CORE:substcont; # opcode