← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Sun Aug 5 15:24:32 2012
Reported on Sun Aug 5 15:24:48 2012

Filename/usr/lib/perl5/5.12.4/i686-linux/DynaLoader.pm
StatementsExecuted 58 statements in 7.65ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.02ms3.50msDynaLoader::::BEGIN@25DynaLoader::BEGIN@25
111541µs1.45msDynaLoader::::bootstrapDynaLoader::bootstrap
111259µs259µsDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
221154µs154µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
21150µs50µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
11148µs48µsDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
11135µs35µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
11120µs20µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
11118µs18µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
11114µs14µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
11114µs14µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
1118µs8µsDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
0000s0sDynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0000s0sDynaLoader::::croakDynaLoader::croak
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2# Generated from DynaLoader_pm.PL
3
4package DynaLoader;
5
6# And Gandalf said: 'Many folk like to know beforehand what is to
7# be set on the table; but those who have laboured to prepare the
8# feast like to keep their secret; for wonder makes the words of
9# praise louder.'
10
11# (Quote from Tolkien suggested by Anno Siegel.)
12#
13# See pod text at end of file for documentation.
14# See also ext/DynaLoader/README in source tree for other information.
15#
16# Tim.Bunce@ig.co.uk, August 1994
17
18
# spent 48µs within DynaLoader::BEGIN@18 which was called: # once (48µs+0s) by List::MoreUtils::BEGIN@6 at line 20
BEGIN {
19131µs $VERSION = '1.10';
201176µs148µs}
# spent 48µs making 1 call to DynaLoader::BEGIN@18
21
221521µsrequire AutoLoader;
23110µs*AUTOLOAD = \&AutoLoader::AUTOLOAD;
24
2535.05ms23.58ms
# spent 3.50ms (3.02+476µs) within DynaLoader::BEGIN@25 which was called: # once (3.02ms+476µs) by List::MoreUtils::BEGIN@6 at line 25
use Config;
# spent 3.50ms making 1 call to DynaLoader::BEGIN@25 # spent 83µs making 1 call to Config::import
26
27# enable debug/trace messages from DynaLoader perl code
2818µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
29
30#
31# Flags to alter dl_load_file behaviour. Assigned bits:
32# 0x01 make symbols available for linking later dl_load_file's.
33# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
34# (ignored under VMS; effect is built-in to image linking)
35#
36# This is called as a class method $module->dl_load_flags. The
37# definition here will be inherited and result on "default" loading
38# behaviour unless a sub-class of DynaLoader defines its own version.
39#
40
41145µs
# spent 14µs within DynaLoader::dl_load_flags which was called: # once (14µs+0s) by DynaLoader::bootstrap at line 200
sub dl_load_flags { 0x00 }
42
431130µs310.4ms($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 10.4ms making 3 calls to Config::FETCH, avg 3.47ms/call
44
45
4613µs$do_expand = 0;
47
- -
5016µs@dl_require_symbols = (); # names of symbols we need
5113µs@dl_resolve_using = (); # names of files to link with
5213µs@dl_library_path = (); # path to look for files
53
54#XSLoader.pm may have added elements before we were required
55#@dl_shared_objects = (); # shared objects for symbols we have
56#@dl_librefs = (); # things we have loaded
57#@dl_modules = (); # Modules we have loaded
58
59# This is a fix to support DLD's unfortunate desire to relink -lc
6013µs@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
61
62# Initialise @dl_library_path with the 'standard' library path
63# for this platform as determined by Configure.
64
65143µs120µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 20µs making 1 call to Config::FETCH
66
67
68132µs121µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 21µs making 1 call to Config::FETCH
69132µs119µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 19µs making 1 call to Config::FETCH
70131µs119µsmy $pthsep = $Config::Config{path_sep};
# spent 19µs making 1 call to Config::FETCH
71
72# Add to @dl_library_path any extra directories we can gather from environment
73# during runtime.
74
7515µsif ($ldlibpthname_defined &&
76 exists $ENV{$ldlibpthname}) {
77 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
78}
79
80# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
81
8214µsif ($ldlibpthname_defined &&
83 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
84 exists $ENV{LD_LIBRARY_PATH}) {
85 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
86}
87
88
89# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
90# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
9116µsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
92 !defined(&dl_error);
93
9412µsif ($dl_debug) {
95 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
96 print STDERR "DynaLoader not linked into this perl\n"
97 unless defined(&boot_DynaLoader);
98}
99
100188µs1; # End of main code
101
102
103sub croak { require Carp; Carp::croak(@_) }
104
105sub bootstrap_inherit {
106 my $module = $_[0];
107 local *isa = *{"$module\::ISA"};
108 local @isa = (@isa, 'DynaLoader');
109 # Cannot goto due to delocalization. Will report errors on a wrong line?
110 bootstrap(@_);
111}
112
113# The bootstrap function cannot be autoloaded (without complications)
114# so we define it here:
115
116
# spent 1.45ms (541µs+911µs) within DynaLoader::bootstrap which was called: # once (541µs+911µs) by List::MoreUtils::BEGIN@9 at line 36 of List/MoreUtils.pm
sub bootstrap {
117 # use local vars to enable $module.bs script to edit values
118351.42ms local(@args) = @_;
119 local($module) = $args[0];
120 local(@dirs, $file);
121
122 unless ($module) {
123 require Carp;
124 Carp::confess("Usage: DynaLoader::bootstrap(module)");
125 }
126
127 # A common error on platforms which don't support dynamic loading.
128 # Since it's fatal and potentially confusing we give a detailed message.
129 croak("Can't load module $module, dynamic loading not available in this perl.\n".
130 " (You may need to build a new perl executable which either supports\n".
131 " dynamic loading or has the $module module statically linked into it.)\n")
132 unless defined(&dl_load_file);
133
- -
136 my @modparts = split(/::/,$module);
137 my $modfname = $modparts[-1];
138
139 # Some systems have restrictions on files names for DLL's etc.
140 # mod2fname returns appropriate file base name (typically truncated)
141 # It may also edit @modparts if required.
142 $modfname = &mod2fname(\@modparts) if defined &mod2fname;
143
144
145
146 my $modpname = join('/',@modparts);
147
148 print STDERR "DynaLoader::bootstrap for $module ",
149 "(auto/$modpname/$modfname.$dl_dlext)\n"
150 if $dl_debug;
151
152 foreach (@INC) {
153
154
155 my $dir = "$_/auto/$modpname";
156
157
158250µs next unless -d $dir; # skip over uninteresting directories
# spent 50µs making 2 calls to DynaLoader::CORE:ftdir, avg 25µs/call
159
160 # check for common cases to avoid autoload of dl_findfile
161 my $try = "$dir/$modfname.$dl_dlext";
162118µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 18µs making 1 call to DynaLoader::CORE:ftfile
163
164 # no luck here, save dir for possible later dl_findfile search
165 push @dirs, $dir;
166 }
167 # last resort, let dl_findfile have a go in all known locations
168 $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
169
170 croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
171 unless $file; # wording similar to error from 'require'
172
173
174 my $bootname = "boot_$module";
175117µs $bootname =~ s/\W/_/g;
# spent 17µs making 1 call to DynaLoader::CORE:subst
176 @dl_require_symbols = ($bootname);
177
178 # Execute optional '.bootstrap' perl script for this module.
179 # The .bs file can be used to configure @dl_resolve_using etc to
180 # match the needs of the individual module on this architecture.
181 my $bs = $file;
1821137µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 137µs making 1 call to DynaLoader::CORE:subst
183120µs if (-s $bs) { # only read file if it's not empty
# spent 20µs making 1 call to DynaLoader::CORE:ftsize
184 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
185 eval { do $bs; };
186 warn "$bs: $@\n" if $@;
187 }
188
189 my $boot_symbol_ref;
190
191
192
193 # Many dynamic extension loading problems will appear to come from
194 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
195 # Often these errors are actually occurring in the initialisation
196 # C code of the extension XS file. Perl reports the error as being
197 # in this perl code simply because this was the last perl code
198 # it executed.
199
2002273µs my $libref = dl_load_file($file, $module->dl_load_flags) or
# spent 259µs making 1 call to DynaLoader::dl_load_file # spent 14µs making 1 call to DynaLoader::dl_load_flags
201 croak("Can't load '$file' for module $module: ".dl_error());
202
203 push(@dl_librefs,$libref); # record loaded object
204
20518µs my @unresolved = dl_undef_symbols();
# spent 8µs making 1 call to DynaLoader::dl_undef_symbols
206 if (@unresolved) {
207 require Carp;
208 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
209 }
210
211114µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 14µs making 1 call to DynaLoader::dl_find_symbol
212 croak("Can't find '$bootname' symbol in $file\n");
213
214 push(@dl_modules, $module); # record loaded module
215
216135µs boot:
# spent 35µs making 1 call to DynaLoader::dl_install_xsub
217 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
218
219 # See comment block above
220
221 push(@dl_shared_objects, $file); # record files loaded
222
2231338µs &$xs(@args);
# spent 338µs making 1 call to List::MoreUtils::bootstrap
224}
225
226
227#sub _check_file { # private utility to handle dl_expandspec vs -f tests
228# my($file) = @_;
229# return $file if (!$do_expand && -f $file); # the common case
230# return $file if ( $do_expand && ($file=dl_expandspec($file)));
231# return undef;
232#}
233
234
235# Let autosplit and the autoloader deal with these functions:
236__END__
 
# spent 50µs within DynaLoader::CORE:ftdir which was called 2 times, avg 25µs/call: # 2 times (50µs+0s) by DynaLoader::bootstrap at line 158, avg 25µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 18µs within DynaLoader::CORE:ftfile which was called: # once (18µs+0s) by DynaLoader::bootstrap at line 162
sub DynaLoader::CORE:ftfile; # opcode
# spent 20µs within DynaLoader::CORE:ftsize which was called: # once (20µs+0s) by DynaLoader::bootstrap at line 183
sub DynaLoader::CORE:ftsize; # opcode
# spent 154µs within DynaLoader::CORE:subst which was called 2 times, avg 77µs/call: # once (137µs+0s) by DynaLoader::bootstrap at line 182 # once (17µs+0s) by DynaLoader::bootstrap at line 175
sub DynaLoader::CORE:subst; # opcode
# spent 14µs within DynaLoader::dl_find_symbol which was called: # once (14µs+0s) by DynaLoader::bootstrap at line 211
sub DynaLoader::dl_find_symbol; # xsub
# spent 35µs within DynaLoader::dl_install_xsub which was called: # once (35µs+0s) by DynaLoader::bootstrap at line 216
sub DynaLoader::dl_install_xsub; # xsub
# spent 259µs within DynaLoader::dl_load_file which was called: # once (259µs+0s) by DynaLoader::bootstrap at line 200
sub DynaLoader::dl_load_file; # xsub
# spent 8µs within DynaLoader::dl_undef_symbols which was called: # once (8µs+0s) by DynaLoader::bootstrap at line 205
sub DynaLoader::dl_undef_symbols; # xsub