← Index
NYTProf Performance Profile   « line view »
For /Users/brian/bin/perls/cpan5.26.1
  Run on Sat Dec 30 01:41:10 2017
Reported on Sat Dec 30 01:44:15 2017

Filename/usr/local/perls/perl-5.26.1/lib/5.26.1/darwin-2level/DynaLoader.pm
StatementsExecuted 98 statements in 8.90ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2112.76ms2.76msDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
222362µs4.78msDynaLoader::::bootstrapDynaLoader::bootstrap
611159µs159µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
421107µs107µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
11144µs44µsDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
42136µs36µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
11135µs99µsDynaLoader::::BEGIN@22DynaLoader::BEGIN@22
21125µs25µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
11118µs18µsDynaLoader::::CORE:regcompDynaLoader::CORE:regcomp (opcode)
21118µs18µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
21117µs17µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
2114µs4µ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
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# [email protected], August 1994
17
18
# spent 44µs within DynaLoader::BEGIN@18 which was called: # once (44µs+0s) by CPAN::has_inst at line 20
BEGIN {
19114µs $VERSION = '1.42';
20171µs144µs}
# spent 44µs making 1 call to DynaLoader::BEGIN@18
21
2223.84ms2163µs
# spent 99µs (35+64) within DynaLoader::BEGIN@22 which was called: # once (35µs+64µs) by CPAN::has_inst at line 22
use Config;
# spent 99µs making 1 call to DynaLoader::BEGIN@22 # spent 64µs making 1 call to Config::import
23
24# enable debug/trace messages from DynaLoader perl code
2513µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
26
27#
28# Flags to alter dl_load_file behaviour. Assigned bits:
29# 0x01 make symbols available for linking later dl_load_file's.
30# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
31# (ignored under VMS; effect is built-in to image linking)
32# (ignored under Android; the linker always uses RTLD_LOCAL)
33#
34# This is called as a class method $module->dl_load_flags. The
35# definition here will be inherited and result on "default" loading
36# behaviour unless a sub-class of DynaLoader defines its own version.
37#
38
39214µs
# spent 4µs within DynaLoader::dl_load_flags which was called 2 times, avg 2µs/call: # 2 times (4µs+0s) by DynaLoader::bootstrap at line 195, avg 2µs/call
sub dl_load_flags { 0x00 }
40
41153µs335µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 35µs making 3 calls to Config::FETCH, avg 12µs/call
42
43
4410s$do_expand = 0;
45
4616µs@dl_require_symbols = (); # names of symbols we need
4710s@dl_library_path = (); # path to look for files
48
49#XSLoader.pm may have added elements before we were required
50#@dl_shared_objects = (); # shared objects for symbols we have
51#@dl_librefs = (); # things we have loaded
52#@dl_modules = (); # Modules we have loaded
53
54# Initialise @dl_library_path with the 'standard' library path
55# for this platform as determined by Configure.
56
57114µs15µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 5µs making 1 call to Config::FETCH
58
59
6017µs14µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 4µs making 1 call to Config::FETCH
6117µs14µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 4µs making 1 call to Config::FETCH
6216µs14µsmy $pthsep = $Config::Config{path_sep};
# spent 4µ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
6713µsif ($ldlibpthname_defined &&
68 exists $ENV{$ldlibpthname}) {
69140µs118µs push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
# spent 18µs making 1 call to DynaLoader::CORE:regcomp
70}
71
72# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
73
7412µsif ($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
81# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
82# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
8311µsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
84 !defined(&dl_error);
85
8610sif ($dl_debug) {
87 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
88 print STDERR "DynaLoader not linked into this perl\n"
89 unless defined(&boot_DynaLoader);
90}
91
92137µs1; # End of main code
93
94
95sub croak { require Carp; Carp::croak(@_) }
96
97sub bootstrap_inherit {
98 my $module = $_[0];
99 local *isa = *{"$module\::ISA"};
100 local @isa = (@isa, 'DynaLoader');
101 # Cannot goto due to delocalization. Will report errors on a wrong line?
102 bootstrap(@_);
103}
104
105
# spent 4.78ms (362µs+4.42) within DynaLoader::bootstrap which was called 2 times, avg 2.39ms/call: # once (255µs+2.14ms) by CPAN::has_inst at line 72 of Time/HiRes.pm # once (107µs+2.28ms) by CPAN::has_inst at line 246 of Digest/SHA.pm
sub bootstrap {
106 # use local vars to enable $module.bs script to edit values
10726µs local(@args) = @_;
10823µs local($module) = $args[0];
10922µs local(@dirs, $file);
110
11122µs unless ($module) {
112 require Carp;
113 Carp::confess("Usage: DynaLoader::bootstrap(module)");
114 }
115
116 # A common error on platforms which don't support dynamic loading.
117 # Since it's fatal and potentially confusing we give a detailed message.
11822µs croak("Can't load module $module, dynamic loading not available in this perl.\n".
119 " (You may need to build a new perl executable which either supports\n".
120 " dynamic loading or has the $module module statically linked into it.)\n")
121 unless defined(&dl_load_file);
122
- -
12528µs my @modparts = split(/::/,$module);
12622µs my $modfname = $modparts[-1];
12722µs my $modfname_orig = $modfname; # For .bs file search
128
129 # Some systems have restrictions on files names for DLL's etc.
130 # mod2fname returns appropriate file base name (typically truncated)
131 # It may also edit @modparts if required.
13221µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
133
134
135
13626µs my $modpname = join('/',@modparts);
137
13820s print STDERR "DynaLoader::bootstrap for $module ",
139 "(auto/$modpname/$modfname.$dl_dlext)\n"
140 if $dl_debug;
141
14222µs my $dir;
14326µs foreach (@INC) {
144
14567µs $dir = "$_/auto/$modpname";
146
1476201µs6159µs next unless -d $dir; # skip over uninteresting directories
# spent 159µs making 6 calls to DynaLoader::CORE:ftdir, avg 26µs/call
148
149 # check for common cases to avoid autoload of dl_findfile
15027µs my $try = "$dir/$modfname.$dl_dlext";
151251µs225µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 25µs making 2 calls to DynaLoader::CORE:ftfile, avg 12µs/call
152
153 # no luck here, save dir for possible later dl_findfile search
154 push @dirs, $dir;
155 }
156 # last resort, let dl_findfile have a go in all known locations
15720s $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
158
15921µs croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
160 unless $file; # wording similar to error from 'require'
161
162
16324µs my $bootname = "boot_$module";
164241µs220µs $bootname =~ s/\W/_/g;
# spent 20µs making 2 calls to DynaLoader::CORE:subst, avg 10µs/call
16524µs @dl_require_symbols = ($bootname);
166
167 # Execute optional '.bootstrap' perl script for this module.
168 # The .bs file can be used to configure @dl_resolve_using etc to
169 # match the needs of the individual module on this architecture.
170 # N.B. The .bs file does not following the naming convention used
171 # by mod2fname.
17224µs my $bs = "$dir/$modfname_orig";
173295µs287µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 87µs making 2 calls to DynaLoader::CORE:subst, avg 44µs/call
174233µs217µs if (-s $bs) { # only read file if it's not empty
# spent 17µs making 2 calls to DynaLoader::CORE:ftsize, avg 8µs/call
175 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
176 eval { local @INC = ('.'); do $bs; };
177 warn "$bs: $@\n" if $@;
178 }
179
18020s my $boot_symbol_ref;
181
182
183246µs226µs if ($boot_symbol_ref = dl_find_symbol(0, $bootname, 1)) {
# spent 26µs making 2 calls to DynaLoader::dl_find_symbol, avg 13µs/call
184 goto boot; #extension library has already been loaded, e.g. darwin
185 }
186
187
188 # Many dynamic extension loading problems will appear to come from
189 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
190 # Often these errors are actually occurring in the initialisation
191 # C code of the extension XS file. Perl reports the error as being
192 # in this perl code simply because this was the last perl code
193 # it executed.
194
195216µs24µs my $flags = $module->dl_load_flags;
# spent 4µs making 2 calls to DynaLoader::dl_load_flags, avg 2µs/call
196
19722.80ms22.76ms my $libref = dl_load_file($file, $flags) or
# spent 2.76ms making 2 calls to DynaLoader::dl_load_file, avg 1.38ms/call
198 croak("Can't load '$file' for module $module: ".dl_error());
199
20024µs push(@dl_librefs,$libref); # record loaded object
201
202227µs210µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 10µs making 2 calls to DynaLoader::dl_find_symbol, avg 5µs/call
203 croak("Can't find '$bootname' symbol in $file\n");
204
20523µs push(@dl_modules, $module); # record loaded module
206
207244µs218µs boot:
# spent 18µs making 2 calls to DynaLoader::dl_install_xsub, avg 9µs/call
208 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
209
210 # See comment block above
211
21223µs push(@dl_shared_objects, $file); # record files loaded
213
21421.34ms21.29ms &$xs(@args);
# spent 810µs making 1 call to Digest::SHA::bootstrap # spent 480µs making 1 call to Time::HiRes::bootstrap
215}
216
217sub dl_findfile {
218 # This function does not automatically consider the architecture
219 # or the perl library auto directories.
220 my (@args) = @_;
221 my (@dirs, $dir); # which directories to search
222 my (@found); # full paths to real files we have found
223 #my $dl_ext= 'bundle'; # $Config::Config{'dlext'} suffix for perl extensions
224 #my $dl_so = 'dylib'; # $Config::Config{'so'} suffix for shared libraries
225
226 print STDERR "dl_findfile(@args)\n" if $dl_debug;
227
228 # accumulate directories but process files as they appear
229 arg: foreach(@args) {
230 # Special fast case: full filepath requires no search
231
232
233 if (m:/: && -f $_) {
234 push(@found,$_);
235 last arg unless wantarray;
236 next;
237 }
238
239
240 # Deal with directories first:
241 # Using a -L prefix is the preferred option (faster and more robust)
242 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
243
244 # Otherwise we try to try to spot directories by a heuristic
245 # (this is a more complicated issue than it first appears)
246 if (m:/: && -d $_) { push(@dirs, $_); next; }
247
248
249
250 # Only files should get this far...
251 my(@names, $name); # what filenames to look for
252 if (m:-l: ) { # convert -lname to appropriate library name
253 s/-l//;
254 push(@names,"lib$_.$dl_so");
255 push(@names,"lib$_.a");
256 } else { # Umm, a bare name. Try various alternatives:
257 # these should be ordered with the most likely first
258 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
259 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
260
261 push(@names,"lib$_.$dl_so") unless m:/:;
262 push(@names, $_);
263 }
264 my $dirsep = '/';
265
266 foreach $dir (@dirs, @dl_library_path) {
267 next unless -d $dir;
268
269 foreach $name (@names) {
270 my($file) = "$dir$dirsep$name";
271 print STDERR " checking in $dir for $name\n" if $dl_debug;
272 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
273 #$file = _check_file($file);
274 if ($file) {
275 push(@found, $file);
276 next arg; # no need to look any further
277 }
278 }
279 }
280 }
281 if ($dl_debug) {
282 foreach(@dirs) {
283 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
284 }
285 print STDERR "dl_findfile found: @found\n";
286 }
287 return $found[0] unless wantarray;
288 @found;
289}
290
- -
293sub dl_expandspec {
294 my($spec) = @_;
295 # Optional function invoked if DynaLoader.pm sets $do_expand.
296 # Most systems do not require or use this function.
297 # Some systems may implement it in the dl_*.xs file in which case
298 # this Perl version should be excluded at build time.
299
300 # This function is designed to deal with systems which treat some
301 # 'filenames' in a special way. For example VMS 'Logical Names'
302 # (something like unix environment variables - but different).
303 # This function should recognise such names and expand them into
304 # full file paths.
305 # Must return undef if $spec is invalid or file does not exist.
306
307 my $file = $spec; # default output to input
308
309 return undef unless -f $file;
310 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
311 $file;
312}
313
314sub dl_find_symbol_anywhere
315{
316 my $sym = shift;
317 my $libref;
318 foreach $libref (@dl_librefs) {
319 my $symref = dl_find_symbol($libref,$sym,1);
320 return $symref if $symref;
321 }
322 return undef;
323}
324
325__END__
 
# spent 159µs within DynaLoader::CORE:ftdir which was called 6 times, avg 26µs/call: # 6 times (159µs+0s) by DynaLoader::bootstrap at line 147, avg 26µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 25µs within DynaLoader::CORE:ftfile which was called 2 times, avg 12µs/call: # 2 times (25µs+0s) by DynaLoader::bootstrap at line 151, avg 12µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 17µs within DynaLoader::CORE:ftsize which was called 2 times, avg 8µs/call: # 2 times (17µs+0s) by DynaLoader::bootstrap at line 174, avg 8µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 18µs within DynaLoader::CORE:regcomp which was called: # once (18µs+0s) by CPAN::has_inst at line 69
sub DynaLoader::CORE:regcomp; # opcode
# spent 107µs within DynaLoader::CORE:subst which was called 4 times, avg 27µs/call: # 2 times (87µs+0s) by DynaLoader::bootstrap at line 173, avg 44µs/call # 2 times (20µs+0s) by DynaLoader::bootstrap at line 164, avg 10µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 36µs within DynaLoader::dl_find_symbol which was called 4 times, avg 9µs/call: # 2 times (26µs+0s) by DynaLoader::bootstrap at line 183, avg 13µs/call # 2 times (10µs+0s) by DynaLoader::bootstrap at line 202, avg 5µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 18µs within DynaLoader::dl_install_xsub which was called 2 times, avg 9µs/call: # 2 times (18µs+0s) by DynaLoader::bootstrap at line 207, avg 9µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 2.76ms within DynaLoader::dl_load_file which was called 2 times, avg 1.38ms/call: # 2 times (2.76ms+0s) by DynaLoader::bootstrap at line 197, avg 1.38ms/call
sub DynaLoader::dl_load_file; # xsub