← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:47 2015

Filename/usr/lib/x86_64-linux-gnu/perl/5.20/DynaLoader.pm
StatementsExecuted 594 statements in 15.5ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
69115.26ms5.26msDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
13112.31ms2.31msDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
1111.76ms1.90msDynaLoader::::BEGIN@21DynaLoader::BEGIN@21
1312121.03ms11.8msDynaLoader::::bootstrapDynaLoader::bootstrap
2621292µs292µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
1311279µs279µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
131177µs77µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
131129µs29µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
131129µs29µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
131127µs27µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
131116µs16µsDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
11112µs12µsDynaLoader::::BEGIN@17DynaLoader::BEGIN@17
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
2
3package DynaLoader;
4
5# And Gandalf said: 'Many folk like to know beforehand what is to
6# be set on the table; but those who have laboured to prepare the
7# feast like to keep their secret; for wonder makes the words of
8# praise louder.'
9
10# (Quote from Tolkien suggested by Anno Siegel.)
11#
12# See pod text at end of file for documentation.
13# See also ext/DynaLoader/README in source tree for other information.
14#
15# Tim.Bunce@ig.co.uk, August 1994
16
17
# spent 12µs within DynaLoader::BEGIN@17 which was called: # once (12µs+0s) by DBI::BEGIN@170 at line 19
BEGIN {
1816µs $VERSION = '1.25';
19132µs112µs}
# spent 12µs making 1 call to DynaLoader::BEGIN@17
20
2122.90ms21.91ms
# spent 1.90ms (1.76+136µs) within DynaLoader::BEGIN@21 which was called: # once (1.76ms+136µs) by DBI::BEGIN@170 at line 21
use Config;
# spent 1.90ms making 1 call to DynaLoader::BEGIN@21 # spent 12µs making 1 call to Config::import
22
23# enable debug/trace messages from DynaLoader perl code
2412µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
25
26#
27# Flags to alter dl_load_file behaviour. Assigned bits:
28# 0x01 make symbols available for linking later dl_load_file's.
29# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
30# (ignored under VMS; effect is built-in to image linking)
31# (ignored under Android; the linker always uses RTLD_LOCAL)
32#
33# This is called as a class method $module->dl_load_flags. The
34# definition here will be inherited and result on "default" loading
35# behaviour unless a sub-class of DynaLoader defines its own version.
36#
37
381330µs
# spent 27µs within DynaLoader::dl_load_flags which was called 13 times, avg 2µs/call: # 13 times (27µs+0s) by DynaLoader::bootstrap at line 185, avg 2µs/call
sub dl_load_flags { 0x00 }
39
401627µs38µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 8µs making 3 calls to Config::FETCH, avg 3µs/call
41
421300ns$do_expand = 0;
43
4411µs@dl_require_symbols = (); # names of symbols we need
451300ns@dl_resolve_using = (); # names of files to link with
461100ns@dl_library_path = (); # path to look for files
47
48#XSLoader.pm may have added elements before we were required
49#@dl_shared_objects = (); # shared objects for symbols we have
50#@dl_librefs = (); # things we have loaded
51#@dl_modules = (); # Modules we have loaded
52
53# This is a fix to support DLD's unfortunate desire to relink -lc
541400ns@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
55
56# Initialise @dl_library_path with the 'standard' library path
57# for this platform as determined by Configure.
58
59110µs13µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 3µs making 1 call to Config::FETCH
60
6113µs12µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
6213µs12µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 2µs making 1 call to Config::FETCH
6313µs12µsmy $pthsep = $Config::Config{path_sep};
# spent 2µs making 1 call to Config::FETCH
64
65# Add to @dl_library_path any extra directories we can gather from environment
66# during runtime.
67
681600nsif ($ldlibpthname_defined &&
69 exists $ENV{$ldlibpthname}) {
70 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
71}
72
73# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
74
751400nsif ($ldlibpthname_defined &&
76 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
77 exists $ENV{LD_LIBRARY_PATH}) {
78 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
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
831900nsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
84 !defined(&dl_error);
85
861100nsif ($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
92118µs1; # End of main code
93
94sub croak { require Carp; Carp::croak(@_) }
95
96sub bootstrap_inherit {
9721µs my $module = $_[0];
9828µs local *isa = *{"$module\::ISA"};
99220µs local @isa = (@isa, 'DynaLoader');
100 # Cannot goto due to delocalization. Will report errors on a wrong line?
101212µs21.01ms bootstrap(@_);
# spent 1.01ms making 2 calls to DynaLoader::bootstrap, avg 506µs/call
102}
103
104
# spent 11.8ms (1.03+10.8) within DynaLoader::bootstrap which was called 13 times, avg 908µs/call: # 2 times (146µs+866µs) by DateTime::TimeZone::Local::BEGIN@8 or parent::import at line 101, avg 506µs/call # once (73µs+2.14ms) by XML::LibXML::BEGIN@31 at line 150 of XML/LibXML.pm # once (79µs+2.08ms) by DBI::install_driver at line 15 of DBD/mysql.pm # once (133µs+920µs) by DBI::BEGIN@173 at line 271 of DBI.pm # once (72µs+834µs) by XML::Parser::BEGIN@17 at line 29 of XML/Parser/Expat.pm # once (86µs+807µs) by Text::CSV::BEGIN@1 at line 34 of Text/CSV_XS.pm # once (70µs+690µs) by MARC::Charset::BEGIN@11 at line 57 of Unicode/Normalize.pm # once (79µs+511µs) by C4::Members::BEGIN@42 at line 32 of Text/Unaccent.pm # once (76µs+513µs) by List::MoreUtils::BEGIN@9 at line 36 of List/MoreUtils.pm # once (74µs+497µs) by Data::OptList::BEGIN@10 at line 88 of Params/Util.pm # once (70µs+490µs) by Date::Calc::BEGIN@18 at line 110 of Date/Calc/XS.pm # once (71µs+428µs) by C4::Charset::BEGIN@24 at line 21 of Text/Iconv.pm
sub bootstrap {
105 # use local vars to enable $module.bs script to edit values
1061318µs local(@args) = @_;
107139µs local($module) = $args[0];
1081310µs local(@dirs, $file);
109
110135µs unless ($module) {
111 require Carp;
112 Carp::confess("Usage: DynaLoader::bootstrap(module)");
113 }
114
115 # A common error on platforms which don't support dynamic loading.
116 # Since it's fatal and potentially confusing we give a detailed message.
117138µs croak("Can't load module $module, dynamic loading not available in this perl.\n".
118 " (You may need to build a new perl executable which either supports\n".
119 " dynamic loading or has the $module module statically linked into it.)\n")
120 unless defined(&dl_load_file);
121
122
1231334µs my @modparts = split(/::/,$module);
124138µs my $modfname = $modparts[-1];
125
126 # Some systems have restrictions on files names for DLL's etc.
127 # mod2fname returns appropriate file base name (typically truncated)
128 # It may also edit @modparts if required.
129136µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
130
131
132
1331318µs my $modpname = join('/',@modparts);
134
135135µs print STDERR "DynaLoader::bootstrap for $module ",
136 "(auto/$modpname/$modfname.$dl_dlext)\n"
137 if $dl_debug;
138
1391325µs foreach (@INC) {
140
1416951µs my $dir = "$_/auto/$modpname";
142
143695.45ms695.26ms next unless -d $dir; # skip over uninteresting directories
# spent 5.26ms making 69 calls to DynaLoader::CORE:ftdir, avg 76µs/call
144
145 # check for common cases to avoid autoload of dl_findfile
1461332µs my $try = "$dir/$modfname.$dl_dlext";
1471378µs1329µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 29µs making 13 calls to DynaLoader::CORE:ftfile, avg 2µs/call
148
149 # no luck here, save dir for possible later dl_findfile search
150 push @dirs, $dir;
151 }
152 # last resort, let dl_findfile have a go in all known locations
153133µs $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
154
155133µs croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
156 unless $file; # wording similar to error from 'require'
157
158
1591312µs my $bootname = "boot_$module";
16013125µs1387µs $bootname =~ s/\W/_/g;
# spent 87µs making 13 calls to DynaLoader::CORE:subst, avg 7µs/call
1611323µs @dl_require_symbols = ($bootname);
162
163 # Execute optional '.bootstrap' perl script for this module.
164 # The .bs file can be used to configure @dl_resolve_using etc to
165 # match the needs of the individual module on this architecture.
166135µs my $bs = $file;
16713228µs13205µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 205µs making 13 calls to DynaLoader::CORE:subst, avg 16µs/call
16813307µs13279µs if (-s $bs) { # only read file if it's not empty
# spent 279µs making 13 calls to DynaLoader::CORE:ftsize, avg 21µs/call
169 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
170 eval { do $bs; };
171 warn "$bs: $@\n" if $@;
172 }
173
174133µs my $boot_symbol_ref;
175
176
177
178 # Many dynamic extension loading problems will appear to come from
179 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
180 # Often these errors are actually occurring in the initialisation
181 # C code of the extension XS file. Perl reports the error as being
182 # in this perl code simply because this was the last perl code
183 # it executed.
184
1851383µs1327µs my $flags = $module->dl_load_flags;
# spent 27µs making 13 calls to DynaLoader::dl_load_flags, avg 2µs/call
186
187132.38ms132.31ms my $libref = dl_load_file($file, $flags) or
# spent 2.31ms making 13 calls to DynaLoader::dl_load_file, avg 178µs/call
188 croak("Can't load '$file' for module $module: ".dl_error());
189
1901315µs push(@dl_librefs,$libref); # record loaded object
191
1921349µs1316µs my @unresolved = dl_undef_symbols();
# spent 16µs making 13 calls to DynaLoader::dl_undef_symbols, avg 1µs/call
193135µs if (@unresolved) {
194 require Carp;
195 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
196 }
197
1981364µs1329µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 29µs making 13 calls to DynaLoader::dl_find_symbol, avg 2µs/call
199 croak("Can't find '$bootname' symbol in $file\n");
200
2011311µs push(@dl_modules, $module); # record loaded module
202
20313119µs1377µs boot:
# spent 77µs making 13 calls to DynaLoader::dl_install_xsub, avg 6µs/call
204 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
205
206 # See comment block above
207
208139µs push(@dl_shared_objects, $file); # record files loaded
209
210132.59ms132.45ms &$xs(@args);
# spent 1.72ms making 1 call to XML::LibXML::bootstrap # spent 245µs making 1 call to DBI::bootstrap # spent 89µs making 1 call to DBD::mysql::bootstrap # spent 86µs making 1 call to Date::Calc::XS::bootstrap # spent 67µs making 1 call to List::MoreUtils::bootstrap # spent 43µs making 1 call to XML::Parser::Expat::bootstrap # spent 43µs making 1 call to Unicode::Normalize::bootstrap # spent 30µs making 1 call to Crypt::Eksblowfish::bootstrap # spent 30µs making 1 call to Text::Unaccent::bootstrap # spent 26µs making 1 call to Text::CSV_XS::bootstrap # spent 25µs making 1 call to Text::Iconv::bootstrap # spent 24µs making 1 call to Cwd::bootstrap # spent 20µs making 1 call to Params::Util::bootstrap
211}
212
213sub dl_findfile {
214 # Read ext/DynaLoader/DynaLoader.doc for detailed information.
215 # This function does not automatically consider the architecture
216 # or the perl library auto directories.
217 my (@args) = @_;
218 my (@dirs, $dir); # which directories to search
219 my (@found); # full paths to real files we have found
220 #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
221 #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
222
223 print STDERR "dl_findfile(@args)\n" if $dl_debug;
224
225 # accumulate directories but process files as they appear
226 arg: foreach(@args) {
227 # Special fast case: full filepath requires no search
228
229
230 if (m:/: && -f $_) {
231 push(@found,$_);
232 last arg unless wantarray;
233 next;
234 }
235
236
237 # Deal with directories first:
238 # Using a -L prefix is the preferred option (faster and more robust)
239 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
240
241 # Otherwise we try to try to spot directories by a heuristic
242 # (this is a more complicated issue than it first appears)
243 if (m:/: && -d $_) { push(@dirs, $_); next; }
244
245
246
247 # Only files should get this far...
248 my(@names, $name); # what filenames to look for
249 if (m:-l: ) { # convert -lname to appropriate library name
250 s/-l//;
251 push(@names,"lib$_.$dl_so");
252 push(@names,"lib$_.a");
253 } else { # Umm, a bare name. Try various alternatives:
254 # these should be ordered with the most likely first
255 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
256 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
257
258 push(@names,"lib$_.$dl_so") unless m:/:;
259 push(@names,"$_.a") if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
260 push(@names, $_);
261 }
262 my $dirsep = '/';
263
264 foreach $dir (@dirs, @dl_library_path) {
265 next unless -d $dir;
266
267 foreach $name (@names) {
268 my($file) = "$dir$dirsep$name";
269 print STDERR " checking in $dir for $name\n" if $dl_debug;
270 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
271 #$file = _check_file($file);
272 if ($file) {
273 push(@found, $file);
274 next arg; # no need to look any further
275 }
276 }
277 }
278 }
279 if ($dl_debug) {
280 foreach(@dirs) {
281 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
282 }
283 print STDERR "dl_findfile found: @found\n";
284 }
285 return $found[0] unless wantarray;
286 @found;
287}
288
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);
316 return $symref if $symref;
317 }
318 return undef;
319}
320
321__END__
 
# spent 5.26ms within DynaLoader::CORE:ftdir which was called 69 times, avg 76µs/call: # 69 times (5.26ms+0s) by DynaLoader::bootstrap at line 143, avg 76µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 29µs within DynaLoader::CORE:ftfile which was called 13 times, avg 2µs/call: # 13 times (29µs+0s) by DynaLoader::bootstrap at line 147, avg 2µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 279µs within DynaLoader::CORE:ftsize which was called 13 times, avg 21µs/call: # 13 times (279µs+0s) by DynaLoader::bootstrap at line 168, avg 21µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 292µs within DynaLoader::CORE:subst which was called 26 times, avg 11µs/call: # 13 times (205µs+0s) by DynaLoader::bootstrap at line 167, avg 16µs/call # 13 times (87µs+0s) by DynaLoader::bootstrap at line 160, avg 7µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 29µs within DynaLoader::dl_find_symbol which was called 13 times, avg 2µs/call: # 13 times (29µs+0s) by DynaLoader::bootstrap at line 198, avg 2µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 77µs within DynaLoader::dl_install_xsub which was called 13 times, avg 6µs/call: # 13 times (77µs+0s) by DynaLoader::bootstrap at line 203, avg 6µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 2.31ms within DynaLoader::dl_load_file which was called 13 times, avg 178µs/call: # 13 times (2.31ms+0s) by DynaLoader::bootstrap at line 187, avg 178µs/call
sub DynaLoader::dl_load_file; # xsub
# spent 16µs within DynaLoader::dl_undef_symbols which was called 13 times, avg 1µs/call: # 13 times (16µs+0s) by DynaLoader::bootstrap at line 192, avg 1µs/call
sub DynaLoader::dl_undef_symbols; # xsub