← Index
NYTProf Performance Profile   « line view »
For ../dm5dm6_ex3
  Run on Tue Feb 24 07:41:47 2015
Reported on Tue Feb 24 07:41:51 2015

Filename/usr/lib/perl5/5.20.1/x86_64-linux-thread-multi/DynaLoader.pm
StatementsExecuted 74 statements in 1.08ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111409µs940µsDynaLoader::::BEGIN@22DynaLoader::BEGIN@22
11150µs140µsDynaLoader::::bootstrapDynaLoader::bootstrap
11130µs30µsDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
22114µs14µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
111113µs13µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
1115µs5µsDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
1113µs3µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
1111µs1µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
1111µs1µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
1111µs1µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
111700ns700nsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
111500ns500nsDynaLoader::::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
2# Generated from DynaLoader_pm.PL
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 5µs within DynaLoader::BEGIN@18 which was called: # once (5µs+0s) by main::BEGIN@10 at line 20
BEGIN {
1913µs $VERSION = '1.25';
20112µs15µs}
# spent 5µs making 1 call to DynaLoader::BEGIN@18
21
222890µs2946µs
# spent 940µs (409+530) within DynaLoader::BEGIN@22 which was called: # once (409µs+530µs) by main::BEGIN@10 at line 22
use Config;
# spent 940µs making 1 call to DynaLoader::BEGIN@22 # spent 7µs making 1 call to Config::import
23
24# enable debug/trace messages from DynaLoader perl code
251900ns$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
3912µs
# spent 700ns within DynaLoader::dl_load_flags which was called: # once (700ns+0s) by DynaLoader::bootstrap at line 191
sub dl_load_flags { 0x00 }
40
4116µ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
42
43
441100ns$do_expand = 0;
45
461400ns@dl_require_symbols = (); # names of symbols we need
471100ns@dl_resolve_using = (); # names of files to link with
481100ns@dl_library_path = (); # path to look for files
49
50#XSLoader.pm may have added elements before we were required
51#@dl_shared_objects = (); # shared objects for symbols we have
52#@dl_librefs = (); # things we have loaded
53#@dl_modules = (); # Modules we have loaded
54
55# This is a fix to support DLD's unfortunate desire to relink -lc
561200ns@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
57
58# Initialise @dl_library_path with the 'standard' library path
59# for this platform as determined by Configure.
60
6118µs1800nspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 800ns making 1 call to Config::FETCH
62
63
6411µs1900nsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 900ns making 1 call to Config::FETCH
6511µs1500nsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 500ns making 1 call to Config::FETCH
661900ns1500nsmy $pthsep = $Config::Config{path_sep};
# spent 500ns making 1 call to Config::FETCH
67
68# Add to @dl_library_path any extra directories we can gather from environment
69# during runtime.
70
711400nsif ($ldlibpthname_defined &&
72 exists $ENV{$ldlibpthname}) {
73 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
74}
75
76# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
77
781200nsif ($ldlibpthname_defined &&
79 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
80 exists $ENV{LD_LIBRARY_PATH}) {
81 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
82}
83
84
85# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
86# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
871300nsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
88 !defined(&dl_error);
89
901100nsif ($dl_debug) {
91 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
92 print STDERR "DynaLoader not linked into this perl\n"
93 unless defined(&boot_DynaLoader);
94}
95
9619µs1; # End of main code
97
98
99sub croak { require Carp; Carp::croak(@_) }
100
101sub bootstrap_inherit {
102 my $module = $_[0];
103 local *isa = *{"$module\::ISA"};
104 local @isa = (@isa, 'DynaLoader');
105 # Cannot goto due to delocalization. Will report errors on a wrong line?
106 bootstrap(@_);
107}
108
109
# spent 140µs (50+90) within DynaLoader::bootstrap which was called: # once (50µs+90µs) by main::BEGIN@10 at line 66 of Time/HiRes.pm
sub bootstrap {
110 # use local vars to enable $module.bs script to edit values
1111700ns local(@args) = @_;
1121300ns local($module) = $args[0];
1131200ns local(@dirs, $file);
114
1151200ns unless ($module) {
116 require Carp;
117 Carp::confess("Usage: DynaLoader::bootstrap(module)");
118 }
119
120 # A common error on platforms which don't support dynamic loading.
121 # Since it's fatal and potentially confusing we give a detailed message.
1221300ns croak("Can't load module $module, dynamic loading not available in this perl.\n".
123 " (You may need to build a new perl executable which either supports\n".
124 " dynamic loading or has the $module module statically linked into it.)\n")
125 unless defined(&dl_load_file);
126
- -
12911µs my @modparts = split(/::/,$module);
1301400ns my $modfname = $modparts[-1];
131
132 # Some systems have restrictions on files names for DLL's etc.
133 # mod2fname returns appropriate file base name (typically truncated)
134 # It may also edit @modparts if required.
1351100ns $modfname = &mod2fname(\@modparts) if defined &mod2fname;
136
137
138
1391800ns my $modpname = join('/',@modparts);
140
1411100ns print STDERR "DynaLoader::bootstrap for $module ",
142 "(auto/$modpname/$modfname.$dl_dlext)\n"
143 if $dl_debug;
144
14511µs foreach (@INC) {
146
147113µs my $dir = "$_/auto/$modpname";
148
1491125µs1113µs next unless -d $dir; # skip over uninteresting directories
# spent 13µs making 11 calls to DynaLoader::CORE:ftdir, avg 1µs/call
150
151 # check for common cases to avoid autoload of dl_findfile
1521600ns my $try = "$dir/$modfname.$dl_dlext";
15314µs11µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 1µs making 1 call to DynaLoader::CORE:ftfile
154
155 # no luck here, save dir for possible later dl_findfile search
156 push @dirs, $dir;
157 }
158 # last resort, let dl_findfile have a go in all known locations
1591100ns $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
160
1611100ns croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
162 unless $file; # wording similar to error from 'require'
163
164
1651400ns my $bootname = "boot_$module";
16614µs12µs $bootname =~ s/\W/_/g;
# spent 2µs making 1 call to DynaLoader::CORE:subst
1671400ns @dl_require_symbols = ($bootname);
168
169 # Execute optional '.bootstrap' perl script for this module.
170 # The .bs file can be used to configure @dl_resolve_using etc to
171 # match the needs of the individual module on this architecture.
1721100ns my $bs = $file;
173113µs111µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 11µs making 1 call to DynaLoader::CORE:subst
17414µs11µs if (-s $bs) { # only read file if it's not empty
# spent 1µs making 1 call to DynaLoader::CORE:ftsize
175 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
176 eval { do $bs; };
177 warn "$bs: $@\n" if $@;
178 }
179
1801100ns 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
19112µs1700ns my $flags = $module->dl_load_flags;
# spent 700ns making 1 call to DynaLoader::dl_load_flags
192
193134µs130µs my $libref = dl_load_file($file, $flags) or
# spent 30µs making 1 call to DynaLoader::dl_load_file
194 croak("Can't load '$file' for module $module: ".dl_error());
195
1961300ns push(@dl_librefs,$libref); # record loaded object
197
19813µs1500ns my @unresolved = dl_undef_symbols();
# spent 500ns making 1 call to DynaLoader::dl_undef_symbols
1991300ns if (@unresolved) {
200 require Carp;
201 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
202 }
203
20413µs11µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 1µs making 1 call to DynaLoader::dl_find_symbol
205 croak("Can't find '$bootname' symbol in $file\n");
206
2071300ns push(@dl_modules, $module); # record loaded module
208
20916µs13µs boot:
# spent 3µs making 1 call to DynaLoader::dl_install_xsub
210 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
211
212 # See comment block above
213
2141200ns push(@dl_shared_objects, $file); # record files loaded
215
216130µs125µs &$xs(@args);
# spent 25µs making 1 call to Time::HiRes::bootstrap
217}
218
219sub dl_findfile {
220 # Read ext/DynaLoader/DynaLoader.doc for detailed information.
221 # This function does not automatically consider the architecture
222 # or the perl library auto directories.
223 my (@args) = @_;
224 my (@dirs, $dir); # which directories to search
225 my (@found); # full paths to real files we have found
226 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
227 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
228
229 print STDERR "dl_findfile(@args)\n" if $dl_debug;
230
231 # accumulate directories but process files as they appear
232 arg: foreach(@args) {
233 # Special fast case: full filepath requires no search
234
235
236 if (m:/: && -f $_) {
237 push(@found,$_);
238 last arg unless wantarray;
239 next;
240 }
241
242
243 # Deal with directories first:
244 # Using a -L prefix is the preferred option (faster and more robust)
245 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
246
247 # Otherwise we try to try to spot directories by a heuristic
248 # (this is a more complicated issue than it first appears)
249 if (m:/: && -d $_) { push(@dirs, $_); next; }
250
251
252
253 # Only files should get this far...
254 my(@names, $name); # what filenames to look for
255 if (m:-l: ) { # convert -lname to appropriate library name
256 s/-l//;
257 push(@names,"lib$_.$dl_so");
258 push(@names,"lib$_.a");
259 } else { # Umm, a bare name. Try various alternatives:
260 # these should be ordered with the most likely first
261 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
262 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
263
264 push(@names,"lib$_.$dl_so") unless m:/:;
265 push(@names,"$_.a") if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
266 push(@names, $_);
267 }
268 my $dirsep = '/';
269
270 foreach $dir (@dirs, @dl_library_path) {
271 next unless -d $dir;
272
273 foreach $name (@names) {
274 my($file) = "$dir$dirsep$name";
275 print STDERR " checking in $dir for $name\n" if $dl_debug;
276 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
277 #$file = _check_file($file);
278 if ($file) {
279 push(@found, $file);
280 next arg; # no need to look any further
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
- -
297sub dl_expandspec {
298 my($spec) = @_;
299 # Optional function invoked if DynaLoader.pm sets $do_expand.
300 # Most systems do not require or use this function.
301 # Some systems may implement it in the dl_*.xs file in which case
302 # this Perl version should be excluded at build time.
303
304 # This function is designed to deal with systems which treat some
305 # 'filenames' in a special way. For example VMS 'Logical Names'
306 # (something like unix environment variables - but different).
307 # This function should recognise such names and expand them into
308 # full file paths.
309 # Must return undef if $spec is invalid or file does not exist.
310
311 my $file = $spec; # default output to input
312
313 return undef unless -f $file;
314 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
315 $file;
316}
317
318sub dl_find_symbol_anywhere
319{
320 my $sym = shift;
321 my $libref;
322 foreach $libref (@dl_librefs) {
323 my $symref = dl_find_symbol($libref,$sym);
324 return $symref if $symref;
325 }
326 return undef;
327}
328
329__END__
 
# spent 13µs within DynaLoader::CORE:ftdir which was called 11 times, avg 1µs/call: # 11 times (13µs+0s) by DynaLoader::bootstrap at line 149, avg 1µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 1µs within DynaLoader::CORE:ftfile which was called: # once (1µs+0s) by DynaLoader::bootstrap at line 153
sub DynaLoader::CORE:ftfile; # opcode
# spent 1µs within DynaLoader::CORE:ftsize which was called: # once (1µs+0s) by DynaLoader::bootstrap at line 174
sub DynaLoader::CORE:ftsize; # opcode
# spent 14µs within DynaLoader::CORE:subst which was called 2 times, avg 7µs/call: # once (11µs+0s) by DynaLoader::bootstrap at line 173 # once (2µs+0s) by DynaLoader::bootstrap at line 166
sub DynaLoader::CORE:subst; # opcode
# spent 1µs within DynaLoader::dl_find_symbol which was called: # once (1µs+0s) by DynaLoader::bootstrap at line 204
sub DynaLoader::dl_find_symbol; # xsub
# spent 3µs within DynaLoader::dl_install_xsub which was called: # once (3µs+0s) by DynaLoader::bootstrap at line 209
sub DynaLoader::dl_install_xsub; # xsub
# spent 30µs within DynaLoader::dl_load_file which was called: # once (30µs+0s) by DynaLoader::bootstrap at line 193
sub DynaLoader::dl_load_file; # xsub
# spent 500ns within DynaLoader::dl_undef_symbols which was called: # once (500ns+0s) by DynaLoader::bootstrap at line 198
sub DynaLoader::dl_undef_symbols; # xsub