← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Tue Nov 7 05:38:10 2017
Reported on Tue Nov 7 06:16:00 2017

Filename/usr/local/lib/perl5/5.24/mach/DynaLoader.pm
StatementsExecuted 432 statements in 13.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11114.72ms4.72msDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
1111112.34ms10.4msDynaLoader::::bootstrapDynaLoader::bootstrap
2221881µs881µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
2611715µs715µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
1111283µs283µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
1111252µs252µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
1111122µs122µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
111175µs75µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
111174µs74µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
11135µs35µsDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
11126µs78µsDynaLoader::::BEGIN@22DynaLoader::BEGIN@22
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# Tim.Bunce@ig.co.uk, August 1994
17
18
# spent 35µs within DynaLoader::BEGIN@18 which was called: # once (35µs+0s) by Mail::SpamAssassin::Logger::Stderr::BEGIN@38 at line 20
BEGIN {
19121µs $VERSION = '1.38';
20140µs135µs}
# spent 35µs making 1 call to DynaLoader::BEGIN@18
21
2223.15ms2130µs
# spent 78µs (26+52) within DynaLoader::BEGIN@22 which was called: # once (26µs+52µs) by Mail::SpamAssassin::Logger::Stderr::BEGIN@38 at line 22
use Config;
# spent 78µs making 1 call to DynaLoader::BEGIN@22 # spent 52µs making 1 call to Config::import
23
24# enable debug/trace messages from DynaLoader perl code
2514µ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
391197µs
# spent 74µs within DynaLoader::dl_load_flags which was called 11 times, avg 7µs/call: # 11 times (74µs+0s) by DynaLoader::bootstrap at line 191, avg 7µs/call
sub dl_load_flags { 0x00 }
40
41142µs337µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 37µs making 3 calls to Config::FETCH, avg 12µs/call
42
43
4412µs$do_expand = 0;
45
4618µs@dl_require_symbols = (); # names of symbols we need
4712µs@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
57115µs115µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 15µs making 1 call to Config::FETCH
58
59
60116µs18µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 8µs making 1 call to Config::FETCH
6119µs17µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 7µs making 1 call to Config::FETCH
6218µs17µsmy $pthsep = $Config::Config{path_sep};
# spent 7µ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
6712µsif ($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
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
8318µsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
84 !defined(&dl_error);
85
8612µsif ($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
92146µ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 10.4ms (2.34+8.06) within DynaLoader::bootstrap which was called 11 times, avg 946µs/call: # once (211µs+2.69ms) by Mail::SpamAssassin::Message::Node::BEGIN@49 at line 46 of Encode/Detect/Detector.pm # once (205µs+1.11ms) by Net::DNS::Domain::BEGIN@54 at line 56 of Net/LibIDN2.pm # once (200µs+664µs) by Net::DNS::Domain::BEGIN@53 at line 99 of Net/LibIDN.pm # once (218µs+573µs) by Mail::SpamAssassin::Message::BEGIN@49 at line 246 of Digest/SHA.pm # once (291µs+457µs) by Mail::SpamAssassin::Logger::Stderr::BEGIN@38 at line 72 of Time/HiRes.pm # once (206µs+487µs) by Mail::SpamAssassin::Util::Progress::BEGIN@52 at line 310 of Term/ReadKey.pm # once (209µs+448µs) by Razor2::String::BEGIN@4 at line 24 of Digest/SHA1.pm # once (209µs+442µs) by Razor2::Preproc::Manager::BEGIN@4 at line 19 of Razor2/Preproc/deHTMLxs.pm # once (199µs+421µs) by Mail::SpamAssassin::NetSet::BEGIN@35 at line 45 of Net/Patricia.pm # once (187µs+423µs) by NetAddr::IP::Lite::BEGIN@18 at line 131 of NetAddr/IP/Util.pm # once (206µs+352µs) by NetAddr::IP::Lite::BEGIN@9 at line 301 of Socket6.pm
sub bootstrap {
106 # use local vars to enable $module.bs script to edit values
1071156µs local(@args) = @_;
1081139µs local($module) = $args[0];
1091131µs local(@dirs, $file);
110
1111121µ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.
1181139µ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
- -
1251185µs my @modparts = split(/::/,$module);
1261128µs my $modfname = $modparts[-1];
1271131µ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.
1321126µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
133
134
135
1361157µs my $modpname = join('/',@modparts);
137
1381124µs print STDERR "DynaLoader::bootstrap for $module ",
139 "(auto/$modpname/$modfname.$dl_dlext)\n"
140 if $dl_debug;
141
1421124µs my $dir;
1431158µs foreach (@INC) {
144
1452670µs $dir = "$_/auto/$modpname";
146
14726917µs26715µs next unless -d $dir; # skip over uninteresting directories
# spent 715µs making 26 calls to DynaLoader::CORE:ftdir, avg 27µs/call
148
149 # check for common cases to avoid autoload of dl_findfile
1501161µs my $try = "$dir/$modfname.$dl_dlext";
15111395µs11283µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 283µs making 11 calls to DynaLoader::CORE:ftfile, avg 26µ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
1571121µs $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
158
1591121µ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
1631142µs my $bootname = "boot_$module";
16411227µs11137µs $bootname =~ s/\W/_/g;
# spent 137µs making 11 calls to DynaLoader::CORE:subst, avg 12µs/call
1651154µ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.
1721136µs my $bs = "$dir/$modfname_orig";
17311816µs11744µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 744µs making 11 calls to DynaLoader::CORE:subst, avg 68µs/call
17411338µs11252µs if (-s $bs) { # only read file if it's not empty
# spent 252µs making 11 calls to DynaLoader::CORE:ftsize, avg 23µs/call
175 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
176 eval { do $bs; };
177 warn "$bs: $@\n" if $@;
178 }
179
1801120µs my $boot_symbol_ref;
181
182
183
184 # Many dynamic extension loading problems will appear to come from
185 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
186 # Often these errors are actually occurring in the initialisation
187 # C code of the extension XS file. Perl reports the error as being
188 # in this perl code simply because this was the last perl code
189 # it executed.
190
19111172µs1174µs my $flags = $module->dl_load_flags;
# spent 74µs making 11 calls to DynaLoader::dl_load_flags, avg 7µs/call
192
193114.91ms114.72ms my $libref = dl_load_file($file, $flags) or
# spent 4.72ms making 11 calls to DynaLoader::dl_load_file, avg 429µs/call
194 croak("Can't load '$file' for module $module: ".dl_error());
195
1961142µs push(@dl_librefs,$libref); # record loaded object
197
19811167µs1175µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 75µs making 11 calls to DynaLoader::dl_find_symbol, avg 7µs/call
199 croak("Can't find '$bootname' symbol in $file\n");
200
2011137µs push(@dl_modules, $module); # record loaded module
202
20311228µs11122µs boot:
# spent 122µs making 11 calls to DynaLoader::dl_install_xsub, avg 11µs/call
204 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
205
206 # See comment block above
207
2081130µs push(@dl_shared_objects, $file); # record files loaded
209
210111.21ms11942µs &$xs(@args);
# spent 200µs making 1 call to Digest::SHA::bootstrap # spent 131µs making 1 call to Net::LibIDN2::bootstrap # spent 87µs making 1 call to Term::ReadKey::bootstrap # spent 82µs making 1 call to Net::LibIDN::bootstrap # spent 78µs making 1 call to NetAddr::IP::Util::bootstrap # spent 78µs making 1 call to Time::HiRes::bootstrap # spent 66µs making 1 call to Net::Patricia::bootstrap # spent 59µs making 1 call to Socket6::bootstrap # spent 58µs making 1 call to Digest::SHA1::bootstrap # spent 56µs making 1 call to Encode::Detect::Detector::bootstrap # spent 48µs making 1 call to Razor2::Preproc::deHTMLxs::bootstrap
211}
212
213sub dl_findfile {
214 # This function does not automatically consider the architecture
215 # or the perl library auto directories.
216 my (@args) = @_;
217 my (@dirs, $dir); # which directories to search
218 my (@found); # full paths to real files we have found
219 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
220 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
221
222 print STDERR "dl_findfile(@args)\n" if $dl_debug;
223
224 # accumulate directories but process files as they appear
225 arg: foreach(@args) {
226 # Special fast case: full filepath requires no search
227
228
229 if (m:/: && -f $_) {
230 push(@found,$_);
231 last arg unless wantarray;
232 next;
233 }
234
235
236 # Deal with directories first:
237 # Using a -L prefix is the preferred option (faster and more robust)
238 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
239
240 # Otherwise we try to try to spot directories by a heuristic
241 # (this is a more complicated issue than it first appears)
242 if (m:/: && -d $_) { push(@dirs, $_); next; }
243
244
245
246 # Only files should get this far...
247 my(@names, $name); # what filenames to look for
248 if (m:-l: ) { # convert -lname to appropriate library name
249 s/-l//;
250 push(@names,"lib$_.$dl_so");
251 push(@names,"lib$_.a");
252 } else { # Umm, a bare name. Try various alternatives:
253 # these should be ordered with the most likely first
254 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
255 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
256
257 push(@names,"lib$_.$dl_so") unless m:/:;
258 push(@names, $_);
259 }
260 my $dirsep = '/';
261
262 foreach $dir (@dirs, @dl_library_path) {
263 next unless -d $dir;
264
265 foreach $name (@names) {
266 my($file) = "$dir$dirsep$name";
267 print STDERR " checking in $dir for $name\n" if $dl_debug;
268 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
269 #$file = _check_file($file);
270 if ($file) {
271 push(@found, $file);
272 next arg; # no need to look any further
273 }
274 }
275 }
276 }
277 if ($dl_debug) {
278 foreach(@dirs) {
279 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
280 }
281 print STDERR "dl_findfile found: @found\n";
282 }
283 return $found[0] unless wantarray;
284 @found;
285}
286
- -
289sub dl_expandspec {
290 my($spec) = @_;
291 # Optional function invoked if DynaLoader.pm sets $do_expand.
292 # Most systems do not require or use this function.
293 # Some systems may implement it in the dl_*.xs file in which case
294 # this Perl version should be excluded at build time.
295
296 # This function is designed to deal with systems which treat some
297 # 'filenames' in a special way. For example VMS 'Logical Names'
298 # (something like unix environment variables - but different).
299 # This function should recognise such names and expand them into
300 # full file paths.
301 # Must return undef if $spec is invalid or file does not exist.
302
303 my $file = $spec; # default output to input
304
305 return undef unless -f $file;
306 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
307 $file;
308}
309
310sub dl_find_symbol_anywhere
311{
312 my $sym = shift;
313 my $libref;
314 foreach $libref (@dl_librefs) {
315 my $symref = dl_find_symbol($libref,$sym,1);
316 return $symref if $symref;
317 }
318 return undef;
319}
320
321__END__
 
# spent 715µs within DynaLoader::CORE:ftdir which was called 26 times, avg 27µs/call: # 26 times (715µs+0s) by DynaLoader::bootstrap at line 147, avg 27µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 283µs within DynaLoader::CORE:ftfile which was called 11 times, avg 26µs/call: # 11 times (283µs+0s) by DynaLoader::bootstrap at line 151, avg 26µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 252µs within DynaLoader::CORE:ftsize which was called 11 times, avg 23µs/call: # 11 times (252µs+0s) by DynaLoader::bootstrap at line 174, avg 23µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 881µs within DynaLoader::CORE:subst which was called 22 times, avg 40µs/call: # 11 times (744µs+0s) by DynaLoader::bootstrap at line 173, avg 68µs/call # 11 times (137µs+0s) by DynaLoader::bootstrap at line 164, avg 12µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 75µs within DynaLoader::dl_find_symbol which was called 11 times, avg 7µs/call: # 11 times (75µs+0s) by DynaLoader::bootstrap at line 198, avg 7µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 122µs within DynaLoader::dl_install_xsub which was called 11 times, avg 11µs/call: # 11 times (122µs+0s) by DynaLoader::bootstrap at line 203, avg 11µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 4.72ms within DynaLoader::dl_load_file which was called 11 times, avg 429µs/call: # 11 times (4.72ms+0s) by DynaLoader::bootstrap at line 193, avg 429µs/call
sub DynaLoader::dl_load_file; # xsub