← 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/lib/perl/5.18/DynaLoader.pm
StatementsExecuted 135 statements in 3.28ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
311555µs555µsDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
333297µs1.22msDynaLoader::::bootstrapDynaLoader::bootstrap
62173µs73µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
101138µs38µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
31120µs20µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
11112µs12µsDynaLoader::::BEGIN@17DynaLoader::BEGIN@17
11110µs26µsDynaLoader::::BEGIN@21DynaLoader::BEGIN@21
31110µs10µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
3118µs8µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
3118µs8µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
3116µs6µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
3114µs4µsDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
0000s0sDynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0000s0sDynaLoader::::croakDynaLoader::croak
0000s0sDynaLoader::::dl_expandspecDynaLoader::dl_expandspec
0000s0sDynaLoader::::dl_find_symbol_anywhereDynaLoader::dl_find_symbol_anywhere
0000s0sDynaLoader::::dl_findfileDynaLoader::dl_findfile
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# Generated from DynaLoader_pm.PL
2
3package DynaLoader;
4
5# And Gandalf said: 'Many folk like to know beforehand what is to
6# be set on the table; but those who have laboured to prepare the
7# feast like to keep their secret; for wonder makes the words of
8# praise louder.'
9
10# (Quote from Tolkien suggested by Anno Siegel.)
11#
12# See pod text at end of file for documentation.
13# See also ext/DynaLoader/README in source tree for other information.
14#
15# Tim.Bunce@ig.co.uk, August 1994
16
17
# spent 12µs within DynaLoader::BEGIN@17 which was called: # once (12µs+0s) by String::Markov::BEGIN@11 at line 19
BEGIN {
1817µs $VERSION = '1.18';
19126µs112µs}
# spent 12µs making 1 call to DynaLoader::BEGIN@17
20
2121.96ms242µs
# spent 26µs (10+16) within DynaLoader::BEGIN@21 which was called: # once (10µs+16µs) by String::Markov::BEGIN@11 at line 21
use Config;
# spent 26µs making 1 call to DynaLoader::BEGIN@21 # spent 16µs making 1 call to Config::import
22
23# enable debug/trace messages from DynaLoader perl code
2412µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
25
26#
27# Flags to alter dl_load_file behaviour. Assigned bits:
28# 0x01 make symbols available for linking later dl_load_file's.
29# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
30# (ignored under VMS; effect is built-in to image linking)
31#
32# This is called as a class method $module->dl_load_flags. The
33# definition here will be inherited and result on "default" loading
34# behaviour unless a sub-class of DynaLoader defines its own version.
35#
36
37310µs
# spent 6µs within DynaLoader::dl_load_flags which was called 3 times, avg 2µs/call: # 3 times (6µs+0s) by DynaLoader::bootstrap at line 184, avg 2µs/call
sub dl_load_flags { 0x00 }
38
39116µs310µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 10µs making 3 calls to Config::FETCH, avg 3µs/call
40
411300ns$do_expand = 0;
42
431800ns@dl_require_symbols = (); # names of symbols we need
441300ns@dl_resolve_using = (); # names of files to link with
451300ns@dl_library_path = (); # path to look for files
46
47#XSLoader.pm may have added elements before we were required
48#@dl_shared_objects = (); # shared objects for symbols we have
49#@dl_librefs = (); # things we have loaded
50#@dl_modules = (); # Modules we have loaded
51
52# This is a fix to support DLD's unfortunate desire to relink -lc
531500ns@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
54
55# Initialise @dl_library_path with the 'standard' library path
56# for this platform as determined by Configure.
57
5817µs12µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 2µs making 1 call to Config::FETCH
59
6014µs12µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
6113µs12µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
6213µs12µsmy $pthsep = $Config::Config{path_sep};
# spent 2µs making 1 call to Config::FETCH
63
64# Add to @dl_library_path any extra directories we can gather from environment
65# during runtime.
66
671800nsif ($ldlibpthname_defined &&
68 exists $ENV{$ldlibpthname}) {
69 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
70}
71
72# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
73
741500nsif ($ldlibpthname_defined &&
75 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
76 exists $ENV{LD_LIBRARY_PATH}) {
77 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
78}
79
80# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
81# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
821900nsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
83 !defined(&dl_error);
84
851300nsif ($dl_debug) {
86 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
87 print STDERR "DynaLoader not linked into this perl\n"
88 unless defined(&boot_DynaLoader);
89}
90
91117µs1; # End of main code
92
93sub croak { require Carp; Carp::croak(@_) }
94
95sub bootstrap_inherit {
96 my $module = $_[0];
97 local *isa = *{"$module\::ISA"};
98 local @isa = (@isa, 'DynaLoader');
99 # Cannot goto due to delocalization. Will report errors on a wrong line?
100 bootstrap(@_);
101}
102
103
# spent 1.22ms (297µs+923µs) within DynaLoader::bootstrap which was called 3 times, avg 407µs/call: # once (138µs+596µs) by String::Markov::BEGIN@11 at line 54 of Unicode/Normalize.pm # once (85µs+180µs) by Data::GUID::BEGIN@7 at line 20 of Data/UUID.pm # once (74µs+147µs) by Data::OptList::BEGIN@10 at line 88 of Params/Util.pm
sub bootstrap {
104 # use local vars to enable $module.bs script to edit values
10535µs local(@args) = @_;
10632µs local($module) = $args[0];
10732µs local(@dirs, $file);
108
1093900ns unless ($module) {
110 require Carp;
111 Carp::confess("Usage: DynaLoader::bootstrap(module)");
112 }
113
114 # A common error on platforms which don't support dynamic loading.
115 # Since it's fatal and potentially confusing we give a detailed message.
11632µs croak("Can't load module $module, dynamic loading not available in this perl.\n".
117 " (You may need to build a new perl executable which either supports\n".
118 " dynamic loading or has the $module module statically linked into it.)\n")
119 unless defined(&dl_load_file);
120
121
12237µs my @modparts = split(/::/,$module);
12333µs my $modfname = $modparts[-1];
124
125 # Some systems have restrictions on files names for DLL's etc.
126 # mod2fname returns appropriate file base name (typically truncated)
127 # It may also edit @modparts if required.
12831µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
129
130
131
132311µs my $modpname = join('/',@modparts);
133
13431µs print STDERR "DynaLoader::bootstrap for $module ",
135 "(auto/$modpname/$modfname.$dl_dlext)\n"
136 if $dl_debug;
137
13836µs foreach (@INC) {
139
140107µs my $dir = "$_/auto/$modpname";
141
1421095µs1038µs next unless -d $dir; # skip over uninteresting directories
# spent 38µs making 10 calls to DynaLoader::CORE:ftdir, avg 4µs/call
143
144 # check for common cases to avoid autoload of dl_findfile
14534µs my $try = "$dir/$modfname.$dl_dlext";
146324µs38µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 8µs making 3 calls to DynaLoader::CORE:ftfile, avg 3µs/call
147
148 # no luck here, save dir for possible later dl_findfile search
149 push @dirs, $dir;
150 }
151 # last resort, let dl_findfile have a go in all known locations
1523900ns $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
153
1543700ns croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
155 unless $file; # wording similar to error from 'require'
156
157
15832µs my $bootname = "boot_$module";
159327µs312µs $bootname =~ s/\W/_/g;
# spent 12µs making 3 calls to DynaLoader::CORE:subst, avg 4µs/call
16034µs @dl_require_symbols = ($bootname);
161
162 # Execute optional '.bootstrap' perl script for this module.
163 # The .bs file can be used to configure @dl_resolve_using etc to
164 # match the needs of the individual module on this architecture.
16531µs my $bs = $file;
166370µs362µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 62µs making 3 calls to DynaLoader::CORE:subst, avg 21µs/call
167319µs310µs if (-s $bs) { # only read file if it's not empty
# spent 10µs making 3 calls to DynaLoader::CORE:ftsize, avg 3µs/call
168 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
169 eval { do $bs; };
170 warn "$bs: $@\n" if $@;
171 }
172
1733800ns my $boot_symbol_ref;
174
175
176
177 # Many dynamic extension loading problems will appear to come from
178 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
179 # Often these errors are actually occurring in the initialisation
180 # C code of the extension XS file. Perl reports the error as being
181 # in this perl code simply because this was the last perl code
182 # it executed.
183
1843594µs6560µs my $libref = dl_load_file($file, $module->dl_load_flags) or
# spent 555µs making 3 calls to DynaLoader::dl_load_file, avg 185µs/call # spent 6µs making 3 calls to DynaLoader::dl_load_flags, avg 2µs/call
185 croak("Can't load '$file' for module $module: ".dl_error());
186
18733µs push(@dl_librefs,$libref); # record loaded object
188
189316µs34µs my @unresolved = dl_undef_symbols();
# spent 4µs making 3 calls to DynaLoader::dl_undef_symbols, avg 1µs/call
19031µs if (@unresolved) {
191 require Carp;
192 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
193 }
194
195318µs38µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 8µs making 3 calls to DynaLoader::dl_find_symbol, avg 3µs/call
196 croak("Can't find '$bootname' symbol in $file\n");
197
19834µs push(@dl_modules, $module); # record loaded module
199
200332µs320µs boot:
# spent 20µs making 3 calls to DynaLoader::dl_install_xsub, avg 6µs/call
201 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
202
203 # See comment block above
204
20532µs push(@dl_shared_objects, $file); # record files loaded
206
2073245µs3201µs &$xs(@args);
# spent 102µs making 1 call to Unicode::Normalize::bootstrap # spent 66µs making 1 call to Data::UUID::bootstrap # spent 33µs making 1 call to Params::Util::bootstrap
208}
209
210sub dl_findfile {
211 # Read ext/DynaLoader/DynaLoader.doc for detailed information.
212 # This function does not automatically consider the architecture
213 # or the perl library auto directories.
214 my (@args) = @_;
215 my (@dirs, $dir); # which directories to search
216 my (@found); # full paths to real files we have found
217 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
218 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
219
220 print STDERR "dl_findfile(@args)\n" if $dl_debug;
221
222 # accumulate directories but process files as they appear
223 arg: foreach(@args) {
224 # Special fast case: full filepath requires no search
225
226
227 if (m:/: && -f $_) {
228 push(@found,$_);
229 last arg unless wantarray;
230 next;
231 }
232
233
234 # Deal with directories first:
235 # Using a -L prefix is the preferred option (faster and more robust)
236 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
237
238 # Otherwise we try to try to spot directories by a heuristic
239 # (this is a more complicated issue than it first appears)
240 if (m:/: && -d $_) { push(@dirs, $_); next; }
241
242
243
244 # Only files should get this far...
245 my(@names, $name); # what filenames to look for
246 if (m:-l: ) { # convert -lname to appropriate library name
247 s/-l//;
248 push(@names,"lib$_.$dl_so");
249 push(@names,"lib$_.a");
250 } else { # Umm, a bare name. Try various alternatives:
251 # these should be ordered with the most likely first
252 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
253 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
254
255 push(@names,"lib$_.$dl_so") unless m:/:;
256 push(@names,"$_.a") if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
257 push(@names, $_);
258 }
259 my $dirsep = '/';
260
261 foreach $dir (@dirs, @dl_library_path) {
262 next unless -d $dir;
263
264 foreach $name (@names) {
265 my($file) = "$dir$dirsep$name";
266 print STDERR " checking in $dir for $name\n" if $dl_debug;
267 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
268 #$file = _check_file($file);
269 if ($file) {
270 push(@found, $file);
271 next arg; # no need to look any further
272 }
273 }
274 }
275 }
276 if ($dl_debug) {
277 foreach(@dirs) {
278 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
279 }
280 print STDERR "dl_findfile found: @found\n";
281 }
282 return $found[0] unless wantarray;
283 @found;
284}
285
286sub dl_expandspec {
287 my($spec) = @_;
288 # Optional function invoked if DynaLoader.pm sets $do_expand.
289 # Most systems do not require or use this function.
290 # Some systems may implement it in the dl_*.xs file in which case
291 # this Perl version should be excluded at build time.
292
293 # This function is designed to deal with systems which treat some
294 # 'filenames' in a special way. For example VMS 'Logical Names'
295 # (something like unix environment variables - but different).
296 # This function should recognise such names and expand them into
297 # full file paths.
298 # Must return undef if $spec is invalid or file does not exist.
299
300 my $file = $spec; # default output to input
301
302 return undef unless -f $file;
303 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
304 $file;
305}
306
307sub dl_find_symbol_anywhere
308{
309 my $sym = shift;
310 my $libref;
311 foreach $libref (@dl_librefs) {
312 my $symref = dl_find_symbol($libref,$sym);
313 return $symref if $symref;
314 }
315 return undef;
316}
317
318__END__
 
# spent 38µs within DynaLoader::CORE:ftdir which was called 10 times, avg 4µs/call: # 10 times (38µs+0s) by DynaLoader::bootstrap at line 142, avg 4µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 8µs within DynaLoader::CORE:ftfile which was called 3 times, avg 3µs/call: # 3 times (8µs+0s) by DynaLoader::bootstrap at line 146, avg 3µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 10µs within DynaLoader::CORE:ftsize which was called 3 times, avg 3µs/call: # 3 times (10µs+0s) by DynaLoader::bootstrap at line 167, avg 3µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 73µs within DynaLoader::CORE:subst which was called 6 times, avg 12µs/call: # 3 times (62µs+0s) by DynaLoader::bootstrap at line 166, avg 21µs/call # 3 times (12µs+0s) by DynaLoader::bootstrap at line 159, avg 4µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 8µs within DynaLoader::dl_find_symbol which was called 3 times, avg 3µs/call: # 3 times (8µs+0s) by DynaLoader::bootstrap at line 195, avg 3µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 20µs within DynaLoader::dl_install_xsub which was called 3 times, avg 6µs/call: # 3 times (20µs+0s) by DynaLoader::bootstrap at line 200, avg 6µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 555µs within DynaLoader::dl_load_file which was called 3 times, avg 185µs/call: # 3 times (555µs+0s) by DynaLoader::bootstrap at line 184, avg 185µs/call
sub DynaLoader::dl_load_file; # xsub
# spent 4µs within DynaLoader::dl_undef_symbols which was called 3 times, avg 1µs/call: # 3 times (4µs+0s) by DynaLoader::bootstrap at line 189, avg 1µs/call
sub DynaLoader::dl_undef_symbols; # xsub