← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:09 2023

Filename/usr/lib/x86_64-linux-gnu/perl-base/DynaLoader.pm
StatementsExecuted 58 statements in 1.21ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11177µs77µsDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
11132µs151µsDynaLoader::::bootstrapDynaLoader::bootstrap
22114µs14µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
1119µs11µsWant::::BEGIN@3 Want::BEGIN@3
1118µs71µsDynaLoader::::BEGIN@27DynaLoader::BEGIN@27
1117µs7µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
1115µs12µsDynaLoader::::BEGIN@31DynaLoader::BEGIN@31
1115µs9µsDynaLoader::::BEGIN@109DynaLoader::BEGIN@109
1112µs2µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
1112µs2µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
1112µs2µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
1112µs2µsDynaLoader::::BEGIN@19DynaLoader::BEGIN@19
111900ns900nsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
111500ns500nsDynaLoader::::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# Generated from DynaLoader_pm.PL, this file is unique for every OS
2
3232µs212µs
# spent 11µs (9+2) within Want::BEGIN@3 which was called: # once (9µs+2µs) by Contextual::Return::BEGIN@361 at line 3
use strict;
# spent 11µs making 1 call to Want::BEGIN@3 # spent 2µs making 1 call to strict::import
4
5package DynaLoader;
6
7# And Gandalf said: 'Many folk like to know beforehand what is to
8# be set on the table; but those who have laboured to prepare the
9# feast like to keep their secret; for wonder makes the words of
10# praise louder.'
11
12# (Quote from Tolkien suggested by Anno Siegel.)
13#
14# See pod text at end of file for documentation.
15# See also ext/DynaLoader/README in source tree for other information.
16#
17# Tim.Bunce@ig.co.uk, August 1994
18
19
# spent 2µs within DynaLoader::BEGIN@19 which was called: # once (2µs+0s) by Contextual::Return::BEGIN@361 at line 21
BEGIN {
2012µs our $VERSION = '1.52';
21126µs12µs}
# spent 2µs making 1 call to DynaLoader::BEGIN@19
22
23# Note: in almost any other piece of code "our" would have been a better
24# option than "use vars", but DynaLoader's bootstrap files need the
25# side effect of the variable being declared in any scope whose current
26# package is DynaLoader, not just the current lexical one.
2717µs163µs
# spent 71µs (8+63) within DynaLoader::BEGIN@27 which was called: # once (8µs+63µs) by Contextual::Return::BEGIN@361 at line 29
use vars qw(@dl_library_path @dl_resolve_using @dl_require_symbols
# spent 63µs making 1 call to vars::import
28 $dl_debug @dl_librefs @dl_modules @dl_shared_objects
29114µs171µs $dl_dlext $dl_so $dlsrc @args $module @dirs $file $bscode);
# spent 71µs making 1 call to DynaLoader::BEGIN@27
30
312187µs218µs
# spent 12µs (5+7) within DynaLoader::BEGIN@31 which was called: # once (5µs+7µs) by Contextual::Return::BEGIN@361 at line 31
use Config;
# spent 12µs making 1 call to DynaLoader::BEGIN@31 # spent 7µs making 1 call to Config::import
32
33# enable debug/trace messages from DynaLoader perl code
341800ns$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
35
36#
37# Flags to alter dl_load_file behaviour. Assigned bits:
38# 0x01 make symbols available for linking later dl_load_file's.
39# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
40# (ignored under VMS; effect is built-in to image linking)
41# (ignored under Android; the linker always uses RTLD_LOCAL)
42#
43# This is called as a class method $module->dl_load_flags. The
44# definition here will be inherited and result on "default" loading
45# behaviour unless a sub-class of DynaLoader defines its own version.
46#
47
4811µs
# spent 500ns within DynaLoader::dl_load_flags which was called: # once (500ns+0s) by DynaLoader::bootstrap at line 199
sub dl_load_flags { 0x00 }
49
5017µs34µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 4µs making 3 calls to Config::FETCH, avg 1µs/call
51
52# Some systems need special handling to expand file specifications
53# (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>)
54# See dl_expandspec() for more details. Should be harmless but
55# inefficient to define on systems that don't need it.
561300nsmy $do_expand = 0;
57
581800ns@dl_require_symbols = (); # names of symbols we need
591100ns@dl_library_path = (); # path to look for files
60
61#XSLoader.pm may have added elements before we were required
62#@dl_shared_objects = (); # shared objects for symbols we have
63#@dl_librefs = (); # things we have loaded
64#@dl_modules = (); # Modules we have loaded
65
66# Initialise @dl_library_path with the 'standard' library path
67# for this platform as determined by Configure.
68
6912µs1600nspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 600ns making 1 call to Config::FETCH
70
711900ns1700nsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 700ns making 1 call to Config::FETCH
7211µs1400nsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 400ns making 1 call to Config::FETCH
731800ns1700nsmy $pthsep = $Config::Config{path_sep};
# spent 700ns making 1 call to Config::FETCH
74
75# Add to @dl_library_path any extra directories we can gather from environment
76# during runtime.
77
781500nsif ($ldlibpthname_defined &&
79 exists $ENV{$ldlibpthname}) {
80 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
81}
82
83# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
84
851200nsif ($ldlibpthname_defined &&
86 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
87 exists $ENV{LD_LIBRARY_PATH}) {
88 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
89}
90
91# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
92# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
931500nsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
94 !defined(&dl_error);
95
961100nsif ($dl_debug) {
97 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
98 print STDERR "DynaLoader not linked into this perl\n"
99 unless defined(&boot_DynaLoader);
100}
101
102111µs1; # End of main code
103
104sub croak { require Carp; Carp::croak(@_) }
105
106sub bootstrap_inherit {
107 my $module = $_[0];
108
1092762µs214µs
# spent 9µs (5+5) within DynaLoader::BEGIN@109 which was called: # once (5µs+5µs) by Contextual::Return::BEGIN@361 at line 109
no strict qw/refs vars/;
# spent 9µs making 1 call to DynaLoader::BEGIN@109 # spent 5µs making 1 call to strict::unimport
110 local *isa = *{"$module\::ISA"};
111 local @isa = (@isa, 'DynaLoader');
112 # Cannot goto due to delocalization. Will report errors on a wrong line?
113 bootstrap(@_);
114}
115
116
# spent 151µs (32+119) within DynaLoader::bootstrap which was called: # once (32µs+119µs) by Contextual::Return::BEGIN@361 at line 17 of Want.pm
sub bootstrap {
117 # use local vars to enable $module.bs script to edit values
1181500ns local(@args) = @_;
1191200ns local($module) = $args[0];
1201300ns local(@dirs, $file);
121
1221100ns 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.
1291200ns 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
134
1351900ns my @modparts = split(/::/,$module);
1361300ns my $modfname = $modparts[-1];
1371200ns my $modfname_orig = $modfname; # For .bs file search
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.
1421100ns $modfname = &mod2fname(\@modparts) if defined &mod2fname;
143
1441500ns my $modpname = join('/',@modparts);
145
1461100ns print STDERR "DynaLoader::bootstrap for $module ",
147 "(auto/$modpname/$modfname.$dl_dlext)\n"
148 if $dl_debug;
149
1501100ns my $dir;
1511400ns foreach (@INC) {
152
1531500ns $dir = "$_/auto/$modpname";
154
155110µs17µs next unless -d $dir; # skip over uninteresting directories
# spent 7µs making 1 call to DynaLoader::CORE:ftdir
156
157 # check for common cases to avoid autoload of dl_findfile
1581400ns my $try = "$dir/$modfname.$dl_dlext";
15916µs12µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 2µs making 1 call to DynaLoader::CORE:ftfile
160
161 # no luck here, save dir for possible later dl_findfile search
162 push @dirs, $dir;
163 }
164 # last resort, let dl_findfile have a go in all known locations
1651200ns $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
166
1671100ns croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
168 unless $file; # wording similar to error from 'require'
169
170
1711200ns my $bootname = "boot_$module";
17212µs1600ns $bootname =~ s/\W/_/g;
# spent 600ns making 1 call to DynaLoader::CORE:subst
1731300ns @dl_require_symbols = ($bootname);
174
175 # Execute optional '.bootstrap' perl script for this module.
176 # The .bs file can be used to configure @dl_resolve_using etc to
177 # match the needs of the individual module on this architecture.
178 # N.B. The .bs file does not following the naming convention used
179 # by mod2fname.
1801200ns my $bs = "$dir/$modfname_orig";
181115µs114µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 14µs making 1 call to DynaLoader::CORE:subst
18214µs12µs if (-s $bs) { # only read file if it's not empty
# spent 2µs making 1 call to DynaLoader::CORE:ftsize
183 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
184 eval { local @INC = ('.'); do $bs; };
185 warn "$bs: $@\n" if $@;
186 }
187
1881100ns my $boot_symbol_ref;
189
190
191
192 # Many dynamic extension loading problems will appear to come from
193 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
194 # Often these errors are actually occurring in the initialisation
195 # C code of the extension XS file. Perl reports the error as being
196 # in this perl code simply because this was the last perl code
197 # it executed.
198
19912µs1500ns my $flags = $module->dl_load_flags;
# spent 500ns making 1 call to DynaLoader::dl_load_flags
200
201181µs177µs my $libref = dl_load_file($file, $flags) or
# spent 77µs making 1 call to DynaLoader::dl_load_file
202 croak("Can't load '$file' for module $module: ".dl_error());
203
2041300ns push(@dl_librefs,$libref); # record loaded object
205
20613µs1900ns $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 900ns making 1 call to DynaLoader::dl_find_symbol
207 croak("Can't find '$bootname' symbol in $file\n");
208
2091300ns push(@dl_modules, $module); # record loaded module
210
21115µs12µs boot:
# spent 2µs making 1 call to DynaLoader::dl_install_xsub
212 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
213
214 # See comment block above
215
2161200ns push(@dl_shared_objects, $file); # record files loaded
217
218117µs111µs &$xs(@args);
# spent 11µs making 1 call to Want::bootstrap
219}
220
221sub dl_findfile {
222 # This function does not automatically consider the architecture
223 # or the perl library auto directories.
224 my (@args) = @_;
225 my (@dirs, $dir); # which directories to search
226 my (@found); # full paths to real files we have found
227 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
228 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
229
230 print STDERR "dl_findfile(@args)\n" if $dl_debug;
231
232 # accumulate directories but process files as they appear
233 arg: foreach(@args) {
234 # Special fast case: full filepath requires no search
235
236
237 if (m:/: && -f $_) {
238 push(@found,$_);
239 last arg unless wantarray;
240 next;
241 }
242
243
244 # Deal with directories first:
245 # Using a -L prefix is the preferred option (faster and more robust)
246 if ( s{^-L}{} ) { push(@dirs, $_); next; }
247
248 # Otherwise we try to try to spot directories by a heuristic
249 # (this is a more complicated issue than it first appears)
250 if (m:/: && -d $_) { push(@dirs, $_); next; }
251
252
253
254 # Only files should get this far...
255 my(@names, $name); # what filenames to look for
256 if ( s{^-l}{} ) { # convert -lname to appropriate library name
257 push(@names, "lib$_.$dl_so", "lib$_.a");
258 } else { # Umm, a bare name. Try various alternatives:
259 # these should be ordered with the most likely first
260 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
261 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
262
263 push(@names,"lib$_.$dl_so") unless m:/:;
264 push(@names, $_);
265 }
266 my $dirsep = '/';
267 foreach $dir (@dirs, @dl_library_path) {
268 next unless -d $dir;
269
270 foreach $name (@names) {
271 my($file) = "$dir$dirsep$name";
272 print STDERR " checking in $dir for $name\n" if $dl_debug;
273 if ($do_expand && ($file = dl_expandspec($file))) {
274 push @found, $file;
275 next arg; # no need to look any further
276 }
277 elsif (-f $file) {
278 push(@found, $file);
279 next arg; # no need to look any further
280 }
281
282 }
283 }
284 }
285 if ($dl_debug) {
286 foreach(@dirs) {
287 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
288 }
289 print STDERR "dl_findfile found: @found\n";
290 }
291 return $found[0] unless wantarray;
292 @found;
293}
294
295sub dl_expandspec {
296 my($spec) = @_;
297 # Optional function invoked if DynaLoader.pm sets $do_expand.
298 # Most systems do not require or use this function.
299 # Some systems may implement it in the dl_*.xs file in which case
300 # this Perl version should be excluded at build time.
301
302 # This function is designed to deal with systems which treat some
303 # 'filenames' in a special way. For example VMS 'Logical Names'
304 # (something like unix environment variables - but different).
305 # This function should recognise such names and expand them into
306 # full file paths.
307 # Must return undef if $spec is invalid or file does not exist.
308
309 my $file = $spec; # default output to input
310
311 return undef unless -f $file;
312 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
313 $file;
314}
315
316sub dl_find_symbol_anywhere
317{
318 my $sym = shift;
319 my $libref;
320 foreach $libref (@dl_librefs) {
321 my $symref = dl_find_symbol($libref,$sym,1);
322 return $symref if $symref;
323 }
324 return undef;
325}
326
327__END__
 
# spent 7µs within DynaLoader::CORE:ftdir which was called: # once (7µs+0s) by DynaLoader::bootstrap at line 155
sub DynaLoader::CORE:ftdir; # opcode
# spent 2µs within DynaLoader::CORE:ftfile which was called: # once (2µs+0s) by DynaLoader::bootstrap at line 159
sub DynaLoader::CORE:ftfile; # opcode
# spent 2µs within DynaLoader::CORE:ftsize which was called: # once (2µs+0s) by DynaLoader::bootstrap at line 182
sub DynaLoader::CORE:ftsize; # opcode
# spent 14µs within DynaLoader::CORE:subst which was called 2 times, avg 7µs/call: # once (14µs+0s) by DynaLoader::bootstrap at line 181 # once (600ns+0s) by DynaLoader::bootstrap at line 172
sub DynaLoader::CORE:subst; # opcode
# spent 900ns within DynaLoader::dl_find_symbol which was called: # once (900ns+0s) by DynaLoader::bootstrap at line 206
sub DynaLoader::dl_find_symbol; # xsub
# spent 2µs within DynaLoader::dl_install_xsub which was called: # once (2µs+0s) by DynaLoader::bootstrap at line 211
sub DynaLoader::dl_install_xsub; # xsub
# spent 77µs within DynaLoader::dl_load_file which was called: # once (77µs+0s) by DynaLoader::bootstrap at line 201
sub DynaLoader::dl_load_file; # xsub