← Index
NYTProf Performance Profile   « line view »
For ./move_planets.pl
  Run on Tue Jan 23 21:11:41 2024
Reported on Tue Jan 23 21:12:47 2024

Filename/usr/local/lib/perl5/5.36/mach/DynaLoader.pm
StatementsExecuted 93 statements in 6.26ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2113.87ms3.87msDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
111691µs787µsDynaLoader::::BEGIN@32DynaLoader::BEGIN@32
111455µs676µsDynaLoader::::BEGIN@28DynaLoader::BEGIN@28
222140µs4.44msDynaLoader::::bootstrapDynaLoader::bootstrap
42142µs42µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
11122µs30µsDynaLoader::::BEGIN@113DynaLoader::BEGIN@113
21121µs21µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
11120µs23µsDBI::::BEGIN@4 DBI::BEGIN@4
21110µs10µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
2117µs7µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
2117µs7µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
2116µs6µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
1114µs4µsDynaLoader::::BEGIN@20DynaLoader::BEGIN@20
2113µs3µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
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
2# Generated from DynaLoader_pm.PL, this file is unique for every OS
3
42101µs226µs
# spent 23µs (20+3) within DBI::BEGIN@4 which was called: # once (20µs+3µs) by DBI::BEGIN@176 at line 4
use strict;
# spent 23µs making 1 call to DBI::BEGIN@4 # spent 3µs making 1 call to strict::import
5
6package DynaLoader;
7
8# And Gandalf said: 'Many folk like to know beforehand what is to
9# be set on the table; but those who have laboured to prepare the
10# feast like to keep their secret; for wonder makes the words of
11# praise louder.'
12
13# (Quote from Tolkien suggested by Anno Siegel.)
14#
15# See pod text at end of file for documentation.
16# See also ext/DynaLoader/README in source tree for other information.
17#
18# Tim.Bunce@ig.co.uk, August 1994
19
20
# spent 4µs within DynaLoader::BEGIN@20 which was called: # once (4µs+0s) by DBI::BEGIN@176 at line 22
BEGIN {
2115µs our $VERSION = '1.52';
22134µs14µs}
# spent 4µs making 1 call to DynaLoader::BEGIN@20
23
24# Note: in almost any other piece of code "our" would have been a better
25# option than "use vars", but DynaLoader's bootstrap files need the
26# side effect of the variable being declared in any scope whose current
27# package is DynaLoader, not just the current lexical one.
28190µs
# spent 676µs (455+221) within DynaLoader::BEGIN@28 which was called: # once (455µs+221µs) by DBI::BEGIN@176 at line 30
use vars qw(@dl_library_path @dl_resolve_using @dl_require_symbols
29 $dl_debug @dl_librefs @dl_modules @dl_shared_objects
30135µs2842µs $dl_dlext $dl_so $dlsrc @args $module @dirs $file $bscode);
# spent 676µs making 1 call to DynaLoader::BEGIN@28 # spent 166µs making 1 call to vars::import
31
322340µs2799µs
# spent 787µs (691+96) within DynaLoader::BEGIN@32 which was called: # once (691µs+96µs) by DBI::BEGIN@176 at line 32
use Config;
# spent 787µs making 1 call to DynaLoader::BEGIN@32 # spent 12µs making 1 call to Config::import
33
34# enable debug/trace messages from DynaLoader perl code
3511µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
36
37#
38# Flags to alter dl_load_file behaviour. Assigned bits:
39# 0x01 make symbols available for linking later dl_load_file's.
40# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
41# (ignored under VMS; effect is built-in to image linking)
42# (ignored under Android; the linker always uses RTLD_LOCAL)
43#
44# This is called as a class method $module->dl_load_flags. The
45# definition here will be inherited and result on "default" loading
46# behaviour unless a sub-class of DynaLoader defines its own version.
47#
48
49210µs
# spent 3µs within DynaLoader::dl_load_flags which was called 2 times, avg 2µs/call: # 2 times (3µs+0s) by DynaLoader::bootstrap at line 204, avg 2µs/call
sub dl_load_flags { 0x00 }
50
51116µs37µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 7µs making 3 calls to Config::FETCH, avg 2µs/call
52
53# Some systems need special handling to expand file specifications
54# (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>)
55# See dl_expandspec() for more details. Should be harmless but
56# inefficient to define on systems that don't need it.
571400nsmy $do_expand = 0;
58
591800ns@dl_require_symbols = (); # names of symbols we need
601400ns@dl_library_path = (); # path to look for files
61
62#XSLoader.pm may have added elements before we were required
63#@dl_shared_objects = (); # shared objects for symbols we have
64#@dl_librefs = (); # things we have loaded
65#@dl_modules = (); # Modules we have loaded
66
67# Initialise @dl_library_path with the 'standard' library path
68# for this platform as determined by Configure.
69
7015µs12µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 2µs making 1 call to Config::FETCH
71
72
7313µs12µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
7413µs12µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
7513µs12µsmy $pthsep = $Config::Config{path_sep};
# spent 2µs making 1 call to Config::FETCH
76
77# Add to @dl_library_path any extra directories we can gather from environment
78# during runtime.
79
8011µsif ($ldlibpthname_defined &&
81 exists $ENV{$ldlibpthname}) {
82 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
83}
84
85# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
86
871600nsif ($ldlibpthname_defined &&
88 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
89 exists $ENV{LD_LIBRARY_PATH}) {
90 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
91}
92
93
94# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
95# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
961700nsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
97 !defined(&dl_error);
98
991200nsif ($dl_debug) {
100 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
101 print STDERR "DynaLoader not linked into this perl\n"
102 unless defined(&boot_DynaLoader);
103}
104
105113µs1; # End of main code
106
107
108sub croak { require Carp; Carp::croak(@_) }
109
110sub bootstrap_inherit {
111 my $module = $_[0];
112
11321.17ms239µs
# spent 30µs (22+9) within DynaLoader::BEGIN@113 which was called: # once (22µs+9µs) by DBI::BEGIN@176 at line 113
no strict qw/refs vars/;
# spent 30µs making 1 call to DynaLoader::BEGIN@113 # spent 9µs making 1 call to strict::unimport
114 local *isa = *{"$module\::ISA"};
115 local @isa = (@isa, 'DynaLoader');
116 # Cannot goto due to delocalization. Will report errors on a wrong line?
117 bootstrap(@_);
118}
119
120
# spent 4.44ms (140µs+4.30) within DynaLoader::bootstrap which was called 2 times, avg 2.22ms/call: # once (70µs+3.93ms) by DBI::install_driver at line 18 of DBD/mysql.pm # once (70µs+366µs) by DBI::BEGIN@179 at line 277 of DBI.pm
sub bootstrap {
121 # use local vars to enable $module.bs script to edit values
12223µs local(@args) = @_;
12322µs local($module) = $args[0];
12421µs local(@dirs, $file);
125
1262900ns unless ($module) {
127 require Carp;
128 Carp::confess("Usage: DynaLoader::bootstrap(module)");
129 }
130
131 # A common error on platforms which don't support dynamic loading.
132 # Since it's fatal and potentially confusing we give a detailed message.
13322µs croak("Can't load module $module, dynamic loading not available in this perl.\n".
134 " (You may need to build a new perl executable which either supports\n".
135 " dynamic loading or has the $module module statically linked into it.)\n")
136 unless defined(&dl_load_file);
137
- -
14024µs my @modparts = split(/::/,$module);
14121µs my $modfname = $modparts[-1];
1422900ns my $modfname_orig = $modfname; # For .bs file search
143
144 # Some systems have restrictions on files names for DLL's etc.
145 # mod2fname returns appropriate file base name (typically truncated)
146 # It may also edit @modparts if required.
14721µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
148
14923µs my $modpname = join('/',@modparts);
150
15121µs print STDERR "DynaLoader::bootstrap for $module ",
152 "(auto/$modpname/$modfname.$dl_dlext)\n"
153 if $dl_debug;
154
1552800ns my $dir;
15622µs foreach (@INC) {
157
15822µs $dir = "$_/auto/$modpname";
159
160231µs221µs next unless -d $dir; # skip over uninteresting directories
# spent 21µs making 2 calls to DynaLoader::CORE:ftdir, avg 11µs/call
161
162 # check for common cases to avoid autoload of dl_findfile
16322µs my $try = "$dir/$modfname.$dl_dlext";
164219µs210µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 10µs making 2 calls to DynaLoader::CORE:ftfile, avg 5µs/call
165
166 # no luck here, save dir for possible later dl_findfile search
167 push @dirs, $dir;
168 }
169 # last resort, let dl_findfile have a go in all known locations
1702900ns $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
171
1722700ns croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
173 unless $file; # wording similar to error from 'require'
174
175
17621µs my $bootname = "boot_$module";
177211µs26µs $bootname =~ s/\W/_/g;
# spent 6µs making 2 calls to DynaLoader::CORE:subst, avg 3µs/call
17822µs @dl_require_symbols = ($bootname);
179
180 # Execute optional '.bootstrap' perl script for this module.
181 # The .bs file can be used to configure @dl_resolve_using etc to
182 # match the needs of the individual module on this architecture.
183 # N.B. The .bs file does not following the naming convention used
184 # by mod2fname.
18521µs my $bs = "$dir/$modfname_orig";
186240µs236µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 36µs making 2 calls to DynaLoader::CORE:subst, avg 18µs/call
187212µs27µs if (-s $bs) { # only read file if it's not empty
# spent 7µs making 2 calls to DynaLoader::CORE:ftsize, avg 3µs/call
188 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
189 eval { local @INC = ('.'); do $bs; };
190 warn "$bs: $@\n" if $@;
191 }
192
1932800ns my $boot_symbol_ref;
194
195
196
197 # Many dynamic extension loading problems will appear to come from
198 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
199 # Often these errors are actually occurring in the initialisation
200 # C code of the extension XS file. Perl reports the error as being
201 # in this perl code simply because this was the last perl code
202 # it executed.
203
20429µs23µs my $flags = $module->dl_load_flags;
# spent 3µs making 2 calls to DynaLoader::dl_load_flags, avg 2µs/call
205
20623.89ms23.87ms my $libref = dl_load_file($file, $flags) or
# spent 3.87ms making 2 calls to DynaLoader::dl_load_file, avg 1.94ms/call
207 croak("Can't load '$file' for module $module: ".dl_error());
208
20923µs push(@dl_librefs,$libref); # record loaded object
210
211212µs26µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 6µs making 2 calls to DynaLoader::dl_find_symbol, avg 3µs/call
212 croak("Can't find '$bootname' symbol in $file\n");
213
21423µs push(@dl_modules, $module); # record loaded module
215
216214µs27µs boot:
# spent 7µs making 2 calls to DynaLoader::dl_install_xsub, avg 4µs/call
217 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
218
219 # See comment block above
220
22122µs push(@dl_shared_objects, $file); # record files loaded
222
2232349µs2330µs &$xs(@args);
# spent 243µs making 1 call to DBI::bootstrap # spent 87µs making 1 call to DBD::mysql::bootstrap
224}
225
226sub dl_findfile {
227 # This function does not automatically consider the architecture
228 # or the perl library auto directories.
229 my (@args) = @_;
230 my (@dirs, $dir); # which directories to search
231 my (@found); # full paths to real files we have found
232 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
233 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
234
235 print STDERR "dl_findfile(@args)\n" if $dl_debug;
236
237 # accumulate directories but process files as they appear
238 arg: foreach(@args) {
239 # Special fast case: full filepath requires no search
240
241
242 if (m:/: && -f $_) {
243 push(@found,$_);
244 last arg unless wantarray;
245 next;
246 }
247
248
249 # Deal with directories first:
250 # Using a -L prefix is the preferred option (faster and more robust)
251 if ( s{^-L}{} ) { push(@dirs, $_); next; }
252
253 # Otherwise we try to try to spot directories by a heuristic
254 # (this is a more complicated issue than it first appears)
255 if (m:/: && -d $_) { push(@dirs, $_); next; }
256
257
258
259 # Only files should get this far...
260 my(@names, $name); # what filenames to look for
261 if ( s{^-l}{} ) { # convert -lname to appropriate library name
262 push(@names, "lib$_.$dl_so", "lib$_.a");
263 } else { # Umm, a bare name. Try various alternatives:
264 # these should be ordered with the most likely first
265 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
266 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
267
268 push(@names,"lib$_.$dl_so") unless m:/:;
269 push(@names, $_);
270 }
271 my $dirsep = '/';
272 foreach $dir (@dirs, @dl_library_path) {
273 next unless -d $dir;
274
275 foreach $name (@names) {
276 my($file) = "$dir$dirsep$name";
277 print STDERR " checking in $dir for $name\n" if $dl_debug;
278 if ($do_expand && ($file = dl_expandspec($file))) {
279 push @found, $file;
280 next arg; # no need to look any further
281 }
282 elsif (-f $file) {
283 push(@found, $file);
284 next arg; # no need to look any further
285 }
286
287 }
288 }
289 }
290 if ($dl_debug) {
291 foreach(@dirs) {
292 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
293 }
294 print STDERR "dl_findfile found: @found\n";
295 }
296 return $found[0] unless wantarray;
297 @found;
298}
299
- -
302sub dl_expandspec {
303 my($spec) = @_;
304 # Optional function invoked if DynaLoader.pm sets $do_expand.
305 # Most systems do not require or use this function.
306 # Some systems may implement it in the dl_*.xs file in which case
307 # this Perl version should be excluded at build time.
308
309 # This function is designed to deal with systems which treat some
310 # 'filenames' in a special way. For example VMS 'Logical Names'
311 # (something like unix environment variables - but different).
312 # This function should recognise such names and expand them into
313 # full file paths.
314 # Must return undef if $spec is invalid or file does not exist.
315
316 my $file = $spec; # default output to input
317
318 return undef unless -f $file;
319 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
320 $file;
321}
322
323sub dl_find_symbol_anywhere
324{
325 my $sym = shift;
326 my $libref;
327 foreach $libref (@dl_librefs) {
328 my $symref = dl_find_symbol($libref,$sym,1);
329 return $symref if $symref;
330 }
331 return undef;
332}
333
334__END__
 
# spent 21µs within DynaLoader::CORE:ftdir which was called 2 times, avg 11µs/call: # 2 times (21µs+0s) by DynaLoader::bootstrap at line 160, avg 11µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 10µs within DynaLoader::CORE:ftfile which was called 2 times, avg 5µs/call: # 2 times (10µs+0s) by DynaLoader::bootstrap at line 164, avg 5µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 7µs within DynaLoader::CORE:ftsize which was called 2 times, avg 3µs/call: # 2 times (7µs+0s) by DynaLoader::bootstrap at line 187, avg 3µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 42µs within DynaLoader::CORE:subst which was called 4 times, avg 11µs/call: # 2 times (36µs+0s) by DynaLoader::bootstrap at line 186, avg 18µs/call # 2 times (6µs+0s) by DynaLoader::bootstrap at line 177, avg 3µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 6µs within DynaLoader::dl_find_symbol which was called 2 times, avg 3µs/call: # 2 times (6µs+0s) by DynaLoader::bootstrap at line 211, avg 3µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 7µs within DynaLoader::dl_install_xsub which was called 2 times, avg 4µs/call: # 2 times (7µs+0s) by DynaLoader::bootstrap at line 216, avg 4µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 3.87ms within DynaLoader::dl_load_file which was called 2 times, avg 1.94ms/call: # 2 times (3.87ms+0s) by DynaLoader::bootstrap at line 206, avg 1.94ms/call
sub DynaLoader::dl_load_file; # xsub