← Index
NYTProf Performance Profile   « block view • line view • sub view »
For reply.pl
  Run on Thu Oct 21 22:40:13 2010
Reported on Thu Oct 21 22:44:43 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/5.13.5/x86_64-linux/DynaLoader.pm
StatementsExecuted 191 statements in 3.39ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
511568µs568µsDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
555560µs2.31msDynaLoader::::bootstrapDynaLoader::bootstrap
1021209µs209µsDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
511104µs104µsDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
51169µs69µsDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
51164µs64µsDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
51137µs37µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
51119µs19µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
11118µs18µsDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
51117µs17µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
11112µs34µsDynaLoader::::BEGIN@25DynaLoader::BEGIN@25
51112µs12µsDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
0000s0sDynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0000s0sDynaLoader::::croakDynaLoader::croak
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 18µs within DynaLoader::BEGIN@18 which was called: # once (18µs+0s) by base::import at line 20
BEGIN {
1916µs $VERSION = '1.10';
20136µs118µs}
# spent 18µs making 1 call to DynaLoader::BEGIN@18
21
221131µsrequire AutoLoader;
2312µs*AUTOLOAD = \&AutoLoader::AUTOLOAD;
24
252823µs255µs
# spent 34µs (12+21) within DynaLoader::BEGIN@25 which was called: # once (12µs+21µs) by base::import at line 25
use Config;
# spent 34µs making 1 call to DynaLoader::BEGIN@25 # spent 21µs making 1 call to Config::import
26
27# enable debug/trace messages from DynaLoader perl code
2812µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
29
30#
31# Flags to alter dl_load_file behaviour. Assigned bits:
32# 0x01 make symbols available for linking later dl_load_file's.
33# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
34# (ignored under VMS; effect is built-in to image linking)
35#
36# This is called as a class method $module->dl_load_flags. The
37# definition here will be inherited and result on "default" loading
38# behaviour unless a sub-class of DynaLoader defines its own version.
39#
40
41524µs
# spent 19µs within DynaLoader::dl_load_flags which was called 5 times, avg 4µs/call: # 5 times (19µs+0s) by DynaLoader::bootstrap at line 196, avg 4µs/call
sub dl_load_flags { 0x00 }
42
43119µs3145µs($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 145µs making 3 calls to Config::FETCH, avg 48µs/call
44
45
4611µs$do_expand = 0;
47
4811µs@dl_require_symbols = (); # names of symbols we need
4911µs@dl_resolve_using = (); # names of files to link with
5011µs@dl_library_path = (); # path to look for files
51
52#XSLoader.pm may have added elements before we were required
53#@dl_shared_objects = (); # shared objects for symbols we have
54#@dl_librefs = (); # things we have loaded
55#@dl_modules = (); # Modules we have loaded
56
57# This is a fix to support DLD's unfortunate desire to relink -lc
5811µs@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
59
60# Initialise @dl_library_path with the 'standard' library path
61# for this platform as determined by Configure.
62
6319µs15µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 5µs making 1 call to Config::FETCH
64
65
6616µs14µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 4µs making 1 call to Config::FETCH
6716µs14µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 4µs making 1 call to Config::FETCH
6815µs14µsmy $pthsep = $Config::Config{path_sep};
# spent 4µs making 1 call to Config::FETCH
69
70# Add to @dl_library_path any extra directories we can gather from environment
71# during runtime.
72
7312µsif ($ldlibpthname_defined &&
74 exists $ENV{$ldlibpthname}) {
75 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
76}
77
78# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
79
8011µsif ($ldlibpthname_defined &&
81 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
82 exists $ENV{LD_LIBRARY_PATH}) {
83 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
84}
85
86
87# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
88# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
8912µsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
90 !defined(&dl_error);
91
9211µsif ($dl_debug) {
93 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
94 print STDERR "DynaLoader not linked into this perl\n"
95 unless defined(&boot_DynaLoader);
96}
97
98119µs1; # End of main code
99
100
101sub croak { require Carp; Carp::croak(@_) }
102
103sub bootstrap_inherit {
104 my $module = $_[0];
105 local *isa = *{"$module\::ISA"};
106 local @isa = (@isa, 'DynaLoader');
107 # Cannot goto due to delocalization. Will report errors on a wrong line?
108 bootstrap(@_);
109}
110
111# The bootstrap function cannot be autoloaded (without complications)
112# so we define it here:
113
114
# spent 2.31ms (560µs+1.75) within DynaLoader::bootstrap which was called 5 times, avg 462µs/call: # once (111µs+496µs) by DBI::install_driver at line 27 of DBD/SQLite.pm # once (105µs+467µs) by DBI::BEGIN@163 at line 261 of DBI.pm # once (140µs+404µs) by Hailo::Engine::Default::BEGIN@12 at line 24 of List/MoreUtils.pm # once (107µs+198µs) by namespace::clean::BEGIN@14 at line 55 of Sub/Name.pm # once (98µs+186µs) by Data::OptList::BEGIN@7 at line 88 of Params/Util.pm
sub bootstrap {
115 # use local vars to enable $module.bs script to edit values
116514µs local(@args) = @_;
11757µs local($module) = $args[0];
11857µs local(@dirs, $file);
119
12056µs unless ($module) {
121 require Carp;
122 Carp::confess("Usage: DynaLoader::bootstrap(module)");
123 }
124
125 # A common error on platforms which don't support dynamic loading.
126 # Since it's fatal and potentially confusing we give a detailed message.
12759µs croak("Can't load module $module, dynamic loading not available in this perl.\n".
128 " (You may need to build a new perl executable which either supports\n".
129 " dynamic loading or has the $module module statically linked into it.)\n")
130 unless defined(&dl_load_file);
131
- -
134519µs my @modparts = split(/::/,$module);
13558µs my $modfname = $modparts[-1];
136
137 # Some systems have restrictions on files names for DLL's etc.
138 # mod2fname returns appropriate file base name (typically truncated)
139 # It may also edit @modparts if required.
14057µs $modfname = &mod2fname(\@modparts) if defined &mod2fname;
141
142
143
144512µs my $modpname = join('/',@modparts);
145
14657µs print STDERR "DynaLoader::bootstrap for $module ",
147 "(auto/$modpname/$modfname.$dl_dlext)\n"
148 if $dl_debug;
149
15059µs foreach (@INC) {
151
152511µs my $dir = "$_/auto/$modpname";
153
1545138µs5104µs next unless -d $dir; # skip over uninteresting directories
# spent 104µs making 5 calls to DynaLoader::CORE:ftdir, avg 21µs/call
155
156 # check for common cases to avoid autoload of dl_findfile
157514µs my $try = "$dir/$modfname.$dl_dlext";
158599µs564µs last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 64µs making 5 calls to DynaLoader::CORE:ftfile, avg 13µs/call
159
160 # no luck here, save dir for possible later dl_findfile search
161 push @dirs, $dir;
162 }
163 # last resort, let dl_findfile have a go in all known locations
16456µs $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
165
16655µs croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
167 unless $file; # wording similar to error from 'require'
168
169
170510µs my $bootname = "boot_$module";
171542µs519µs $bootname =~ s/\W/_/g;
# spent 19µs making 5 calls to DynaLoader::CORE:subst, avg 4µs/call
172512µs @dl_require_symbols = ($bootname);
173
174 # Execute optional '.bootstrap' perl script for this module.
175 # The .bs file can be used to configure @dl_resolve_using etc to
176 # match the needs of the individual module on this architecture.
17759µs my $bs = $file;
1785210µs5190µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 190µs making 5 calls to DynaLoader::CORE:subst, avg 38µs/call
179594µs569µs if (-s $bs) { # only read file if it's not empty
# spent 69µs making 5 calls to DynaLoader::CORE:ftsize, avg 14µs/call
180 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
181 eval { do $bs; };
182 warn "$bs: $@\n" if $@;
183 }
184
18556µs my $boot_symbol_ref;
186
187
188
189 # Many dynamic extension loading problems will appear to come from
190 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
191 # Often these errors are actually occurring in the initialisation
192 # C code of the extension XS file. Perl reports the error as being
193 # in this perl code simply because this was the last perl code
194 # it executed.
195
1965638µs10588µs my $libref = dl_load_file($file, $module->dl_load_flags) or
# spent 568µs making 5 calls to DynaLoader::dl_load_file, avg 114µs/call # spent 19µs making 5 calls to DynaLoader::dl_load_flags, avg 4µs/call
197 croak("Can't load '$file' for module $module: ".dl_error());
198
199510µs push(@dl_librefs,$libref); # record loaded object
200
201535µs512µs my @unresolved = dl_undef_symbols();
# spent 12µs making 5 calls to DynaLoader::dl_undef_symbols, avg 2µs/call
20256µs if (@unresolved) {
203 require Carp;
204 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
205 }
206
207538µs517µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 17µs making 5 calls to DynaLoader::dl_find_symbol, avg 3µs/call
208 croak("Can't find '$bootname' symbol in $file\n");
209
21059µs push(@dl_modules, $module); # record loaded module
211
212567µs537µs boot:
# spent 37µs making 5 calls to DynaLoader::dl_install_xsub, avg 7µs/call
213 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
214
215 # See comment block above
216
21758µs push(@dl_shared_objects, $file); # record files loaded
218
2195720µs5653µs &$xs(@args);
# spent 273µs making 1 call to DBI::bootstrap # spent 210µs making 1 call to DBD::SQLite::bootstrap # spent 114µs making 1 call to List::MoreUtils::bootstrap # spent 32µs making 1 call to Params::Util::bootstrap # spent 23µs making 1 call to Sub::Name::bootstrap
220}
221
222
223#sub _check_file { # private utility to handle dl_expandspec vs -f tests
224# my($file) = @_;
225# return $file if (!$do_expand && -f $file); # the common case
226# return $file if ( $do_expand && ($file=dl_expandspec($file)));
227# return undef;
228#}
229
230
231# Let autosplit and the autoloader deal with these functions:
232__END__
 
# spent 104µs within DynaLoader::CORE:ftdir which was called 5 times, avg 21µs/call: # 5 times (104µs+0s) by DynaLoader::bootstrap at line 154, avg 21µs/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 64µs within DynaLoader::CORE:ftfile which was called 5 times, avg 13µs/call: # 5 times (64µs+0s) by DynaLoader::bootstrap at line 158, avg 13µs/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 69µs within DynaLoader::CORE:ftsize which was called 5 times, avg 14µs/call: # 5 times (69µs+0s) by DynaLoader::bootstrap at line 179, avg 14µs/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 209µs within DynaLoader::CORE:subst which was called 10 times, avg 21µs/call: # 5 times (190µs+0s) by DynaLoader::bootstrap at line 178, avg 38µs/call # 5 times (19µs+0s) by DynaLoader::bootstrap at line 171, avg 4µs/call
sub DynaLoader::CORE:subst; # opcode
# spent 17µs within DynaLoader::dl_find_symbol which was called 5 times, avg 3µs/call: # 5 times (17µs+0s) by DynaLoader::bootstrap at line 207, avg 3µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 37µs within DynaLoader::dl_install_xsub which was called 5 times, avg 7µs/call: # 5 times (37µs+0s) by DynaLoader::bootstrap at line 212, avg 7µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 568µs within DynaLoader::dl_load_file which was called 5 times, avg 114µs/call: # 5 times (568µs+0s) by DynaLoader::bootstrap at line 196, avg 114µs/call
sub DynaLoader::dl_load_file; # xsub
# spent 12µs within DynaLoader::dl_undef_symbols which was called 5 times, avg 2µs/call: # 5 times (12µs+0s) by DynaLoader::bootstrap at line 201, avg 2µs/call
sub DynaLoader::dl_undef_symbols; # xsub