Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/5.13.5/x86_64-linux/DynaLoader.pm |
Statements | Executed 241 statements in 3.75ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
6 | 6 | 6 | 686µs | 2.57ms | bootstrap | DynaLoader::
6 | 1 | 1 | 638µs | 638µs | dl_load_file (xsub) | DynaLoader::
1 | 1 | 1 | 560µs | 662µs | BEGIN@25 | DynaLoader::
12 | 2 | 1 | 219µs | 219µs | CORE:subst (opcode) | DynaLoader::
14 | 1 | 1 | 142µs | 142µs | CORE:ftdir (opcode) | DynaLoader::
6 | 1 | 1 | 71µs | 71µs | CORE:ftsize (opcode) | DynaLoader::
6 | 1 | 1 | 64µs | 64µs | CORE:ftfile (opcode) | DynaLoader::
6 | 1 | 1 | 42µs | 42µs | dl_install_xsub (xsub) | DynaLoader::
6 | 1 | 1 | 22µs | 22µs | dl_load_flags | DynaLoader::
6 | 1 | 1 | 19µs | 19µs | dl_find_symbol (xsub) | DynaLoader::
1 | 1 | 1 | 18µs | 18µs | BEGIN@18 | DynaLoader::
6 | 1 | 1 | 14µs | 14µs | dl_undef_symbols (xsub) | DynaLoader::
0 | 0 | 0 | 0s | 0s | bootstrap_inherit | DynaLoader::
0 | 0 | 0 | 0s | 0s | croak | DynaLoader::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | # Generated from DynaLoader_pm.PL | ||||
3 | |||||
4 | package 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 Data::OptList::BEGIN@7 at line 20 | ||||
19 | 1 | 6µs | $VERSION = '1.10'; | ||
20 | 1 | 39µs | 1 | 18µs | } # spent 18µs making 1 call to DynaLoader::BEGIN@18 |
21 | |||||
22 | 1 | 130µs | require AutoLoader; | ||
23 | 1 | 2µs | *AUTOLOAD = \&AutoLoader::AUTOLOAD; | ||
24 | |||||
25 | 2 | 916µs | 2 | 680µs | # spent 662µs (560+103) within DynaLoader::BEGIN@25 which was called:
# once (560µs+103µs) by Data::OptList::BEGIN@7 at line 25 # spent 662µs making 1 call to DynaLoader::BEGIN@25
# spent 18µs making 1 call to Config::import |
26 | |||||
27 | # enable debug/trace messages from DynaLoader perl code | ||||
28 | 1 | 2µ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 | |||||
41 | 6 | 27µs | # spent 22µs within DynaLoader::dl_load_flags which was called 6 times, avg 4µs/call:
# 6 times (22µs+0s) by DynaLoader::bootstrap at line 196, avg 4µs/call | ||
42 | |||||
43 | 1 | 21µs | 3 | 2.41ms | ($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)}; # spent 2.41ms making 3 calls to Config::FETCH, avg 803µs/call |
44 | |||||
45 | |||||
46 | 1 | 1µs | $do_expand = 0; | ||
47 | |||||
48 | 1 | 2µs | @dl_require_symbols = (); # names of symbols we need | ||
49 | 1 | 1µs | @dl_resolve_using = (); # names of files to link with | ||
50 | 1 | 1µ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 | ||||
58 | 1 | 2µ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 | |||||
63 | 1 | 9µs | 1 | 5µs | push(@dl_library_path, split(' ', $Config::Config{libpth})); # spent 5µs making 1 call to Config::FETCH |
64 | |||||
65 | |||||
66 | 1 | 6µs | 1 | 4µs | my $ldlibpthname = $Config::Config{ldlibpthname}; # spent 4µs making 1 call to Config::FETCH |
67 | 1 | 6µs | 1 | 4µs | my $ldlibpthname_defined = defined $Config::Config{ldlibpthname}; # spent 4µs making 1 call to Config::FETCH |
68 | 1 | 5µs | 1 | 5µs | my $pthsep = $Config::Config{path_sep}; # spent 5µ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 | |||||
73 | 1 | 2µs | if ($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 | |||||
80 | 1 | 1µs | if ($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 | ||||
89 | 1 | 2µs | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && | ||
90 | !defined(&dl_error); | ||||
91 | |||||
92 | 1 | 1µs | if ($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 | |||||
98 | 1 | 20µs | 1; # End of main code | ||
99 | |||||
100 | |||||
101 | sub croak { require Carp; Carp::croak(@_) } | ||||
102 | |||||
103 | sub 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.57ms (686µs+1.89) within DynaLoader::bootstrap which was called 6 times, avg 429µs/call:
# once (113µs+492µs) by DBI::install_driver at line 27 of DBD/SQLite.pm
# once (111µs+454µs) by DBI::BEGIN@163 at line 261 of DBI.pm
# once (112µs+277µs) by Hailo::Engine::Default::BEGIN@6 at line 24 of List/MoreUtils.pm
# once (124µs+257µs) by Term::Sk::BEGIN@6 at line 65 of Time/HiRes.pm
# once (120µs+217µs) by Data::OptList::BEGIN@7 at line 88 of Params/Util.pm
# once (107µs+191µs) by namespace::clean::BEGIN@14 at line 55 of Sub/Name.pm | ||||
115 | # use local vars to enable $module.bs script to edit values | ||||
116 | 174 | 2.20ms | local(@args) = @_; | ||
117 | local($module) = $args[0]; | ||||
118 | local(@dirs, $file); | ||||
119 | |||||
120 | 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. | ||||
127 | 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 | |||||
- - | |||||
134 | my @modparts = split(/::/,$module); | ||||
135 | 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. | ||||
140 | $modfname = &mod2fname(\@modparts) if defined &mod2fname; | ||||
141 | |||||
142 | |||||
143 | |||||
144 | my $modpname = join('/',@modparts); | ||||
145 | |||||
146 | print STDERR "DynaLoader::bootstrap for $module ", | ||||
147 | "(auto/$modpname/$modfname.$dl_dlext)\n" | ||||
148 | if $dl_debug; | ||||
149 | |||||
150 | foreach (@INC) { | ||||
151 | |||||
152 | 40 | 357µs | my $dir = "$_/auto/$modpname"; | ||
153 | |||||
154 | 14 | 142µs | next unless -d $dir; # skip over uninteresting directories # spent 142µs making 14 calls to DynaLoader::CORE:ftdir, avg 10µs/call | ||
155 | |||||
156 | # check for common cases to avoid autoload of dl_findfile | ||||
157 | my $try = "$dir/$modfname.$dl_dlext"; | ||||
158 | 6 | 64µs | last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try); # spent 64µs making 6 calls to DynaLoader::CORE:ftfile, avg 11µ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 | ||||
164 | $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file; | ||||
165 | |||||
166 | 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 | |||||
170 | my $bootname = "boot_$module"; | ||||
171 | 6 | 21µs | $bootname =~ s/\W/_/g; # spent 21µs making 6 calls to DynaLoader::CORE:subst, avg 4µs/call | ||
172 | @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. | ||||
177 | my $bs = $file; | ||||
178 | 6 | 198µs | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library # spent 198µs making 6 calls to DynaLoader::CORE:subst, avg 33µs/call | ||
179 | 6 | 71µs | if (-s $bs) { # only read file if it's not empty # spent 71µs making 6 calls to DynaLoader::CORE:ftsize, avg 12µs/call | ||
180 | print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | ||||
181 | eval { do $bs; }; | ||||
182 | warn "$bs: $@\n" if $@; | ||||
183 | } | ||||
184 | |||||
185 | 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 | |||||
196 | 12 | 660µs | my $libref = dl_load_file($file, $module->dl_load_flags) or # spent 638µs making 6 calls to DynaLoader::dl_load_file, avg 106µs/call
# spent 22µs making 6 calls to DynaLoader::dl_load_flags, avg 4µs/call | ||
197 | croak("Can't load '$file' for module $module: ".dl_error()); | ||||
198 | |||||
199 | push(@dl_librefs,$libref); # record loaded object | ||||
200 | |||||
201 | 6 | 14µs | my @unresolved = dl_undef_symbols(); # spent 14µs making 6 calls to DynaLoader::dl_undef_symbols, avg 2µs/call | ||
202 | if (@unresolved) { | ||||
203 | require Carp; | ||||
204 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | ||||
205 | } | ||||
206 | |||||
207 | 6 | 19µs | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or # spent 19µs making 6 calls to DynaLoader::dl_find_symbol, avg 3µs/call | ||
208 | croak("Can't find '$bootname' symbol in $file\n"); | ||||
209 | |||||
210 | push(@dl_modules, $module); # record loaded module | ||||
211 | |||||
212 | 6 | 42µs | boot: # spent 42µs making 6 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 | |||||
217 | push(@dl_shared_objects, $file); # record files loaded | ||||
218 | |||||
219 | 6 | 656µs | &$xs(@args); # spent 262µs making 1 call to DBI::bootstrap
# spent 207µs making 1 call to DBD::SQLite::bootstrap
# spent 78µs making 1 call to List::MoreUtils::bootstrap
# spent 52µs making 1 call to Time::HiRes::bootstrap
# spent 36µs making 1 call to Params::Util::bootstrap
# spent 20µ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 142µs within DynaLoader::CORE:ftdir which was called 14 times, avg 10µs/call:
# 14 times (142µs+0s) by DynaLoader::bootstrap at line 154, avg 10µs/call | |||||
# spent 64µs within DynaLoader::CORE:ftfile which was called 6 times, avg 11µs/call:
# 6 times (64µs+0s) by DynaLoader::bootstrap at line 158, avg 11µs/call | |||||
# spent 71µs within DynaLoader::CORE:ftsize which was called 6 times, avg 12µs/call:
# 6 times (71µs+0s) by DynaLoader::bootstrap at line 179, avg 12µs/call | |||||
sub DynaLoader::CORE:subst; # opcode | |||||
# spent 19µs within DynaLoader::dl_find_symbol which was called 6 times, avg 3µs/call:
# 6 times (19µs+0s) by DynaLoader::bootstrap at line 207, avg 3µs/call | |||||
# spent 42µs within DynaLoader::dl_install_xsub which was called 6 times, avg 7µs/call:
# 6 times (42µs+0s) by DynaLoader::bootstrap at line 212, avg 7µs/call | |||||
# spent 638µs within DynaLoader::dl_load_file which was called 6 times, avg 106µs/call:
# 6 times (638µs+0s) by DynaLoader::bootstrap at line 196, avg 106µs/call | |||||
# spent 14µs within DynaLoader::dl_undef_symbols which was called 6 times, avg 2µs/call:
# 6 times (14µs+0s) by DynaLoader::bootstrap at line 201, avg 2µs/call |