Profile of DynaLoader.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:25 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/x86_64-linux/DynaLoader.pm
Statements | Executed 318 statements in 4.03ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
8 | 1 | 1 | 910µs | 910µs | DynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
8 | 8 | 8 | 613µs | 3.05ms | DynaLoader::::bootstrapDynaLoader::bootstrap
1 | 1 | 1 | 459µs | 544µs | DynaLoader::::BEGIN@25DynaLoader::BEGIN@25
16 | 2 | 1 | 309µs | 309µs | DynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
18 | 1 | 1 | 82µs | 82µs | DynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
8 | 1 | 1 | 66µs | 66µs | DynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
8 | 1 | 1 | 30µs | 30µs | DynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
8 | 1 | 1 | 26µs | 26µs | DynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
8 | 1 | 1 | 22µs | 22µs | DynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
8 | 1 | 1 | 14µs | 14µs | DynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
8 | 1 | 1 | 12µs | 12µs | DynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
1 | 1 | 1 | 7µs | 7µs | DynaLoader::::BEGIN@18DynaLoader::BEGIN@18
0 | 0 | 0 | 0s | 0s | DynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0 | 0 | 0 | 0s | 0s | DynaLoader::::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 |  |  |  |  |
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 7µs within DynaLoader::BEGIN@18 which was called: # once (7µs+0s) by Data::OptList::BEGIN@10 at line 20 BEGIN {
19 | 1 | 7µs |  |  | $VERSION = '1.10';
20 | 1 | 30µs | 1 | 7µs | } # spent 7µs making 1 call to DynaLoader::BEGIN@18
21 |  |  |  |  |
22 | 1 | 69µs |  |  | require AutoLoader;
23 | 1 | 2µs |  |  | *AUTOLOAD = \&AutoLoader::AUTOLOAD;
24 |  |  |  |  |
25 | 3 | 768µs | 2 | 553µs | # spent 544µs (459+85) within DynaLoader::BEGIN@25 which was called: # once (459µs+85µs) by Data::OptList::BEGIN@10 at line 25 use Config; # spent 544µs making 1 call to DynaLoader::BEGIN@25 # spent 9µ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 | 8 | 21µs |  |  | # spent 14µs within DynaLoader::dl_load_flags which was called 8 times, avg 2µs/call: # 8 times (14µs+0s) by DynaLoader::bootstrap at line 200, avg 2µs/call sub dl_load_flags { 0x00 }
42 |  |  |  |  |
43 | 1 | 17µs | 3 | 1.84ms | ($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)}; # spent 1.84ms making 3 calls to Config::FETCH, avg 613µs/call
44 |  |  |  |  |
45 |  |  |  |  |
46 | 1 | 700ns |  |  | $do_expand = 0;
47 |  |  |  |  |
- - |  |  |  |  |
50 | 1 | 1µs |  |  | @dl_require_symbols = (); # names of symbols we need
51 | 1 | 800ns |  |  | @dl_resolve_using = (); # names of files to link with
52 | 1 | 600ns |  |  | @dl_library_path = (); # path to look for files
53 |  |  |  |  |
54 |  |  |  |  | #XSLoader.pm may have added elements before we were required
55 |  |  |  |  | #@dl_shared_objects = (); # shared objects for symbols we have
56 |  |  |  |  | #@dl_librefs = (); # things we have loaded
57 |  |  |  |  | #@dl_modules = (); # Modules we have loaded
58 |  |  |  |  |
59 |  |  |  |  | # This is a fix to support DLD's unfortunate desire to relink -lc
60 | 1 | 800ns |  |  | @dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
61 |  |  |  |  |
62 |  |  |  |  | # Initialise @dl_library_path with the 'standard' library path
63 |  |  |  |  | # for this platform as determined by Configure.
64 |  |  |  |  |
65 | 1 | 8µs | 1 | 2µs | push(@dl_library_path, split(' ', $Config::Config{libpth})); # spent 2µs making 1 call to Config::FETCH
66 |  |  |  |  |
67 |  |  |  |  |
68 | 1 | 4µs | 1 | 2µs | my $ldlibpthname = $Config::Config{ldlibpthname}; # spent 2µs making 1 call to Config::FETCH
69 | 1 | 3µs | 1 | 1µs | my $ldlibpthname_defined = defined $Config::Config{ldlibpthname}; # spent 1µs making 1 call to Config::FETCH
70 | 1 | 3µs | 1 | 1µs | my $pthsep = $Config::Config{path_sep}; # spent 1µs making 1 call to Config::FETCH
71 |  |  |  |  |
72 |  |  |  |  | # Add to @dl_library_path any extra directories we can gather from environment
73 |  |  |  |  | # during runtime.
74 |  |  |  |  |
75 | 1 | 1µs |  |  | if ($ldlibpthname_defined &&
76 |  |  |  |  | exists $ENV{$ldlibpthname}) {
77 |  |  |  |  | push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
78 |  |  |  |  | }
79 |  |  |  |  |
80 |  |  |  |  | # E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
81 |  |  |  |  |
82 | 1 | 800ns |  |  | if ($ldlibpthname_defined &&
83 |  |  |  |  | $ldlibpthname ne 'LD_LIBRARY_PATH' &&
84 |  |  |  |  | exists $ENV{LD_LIBRARY_PATH}) {
85 |  |  |  |  | push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
86 |  |  |  |  | }
87 |  |  |  |  |
88 |  |  |  |  |
89 |  |  |  |  | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
90 |  |  |  |  | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
91 | 1 | 2µs |  |  | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
92 |  |  |  |  | !defined(&dl_error);
93 |  |  |  |  |
94 | 1 | 300ns |  |  | if ($dl_debug) {
95 |  |  |  |  | print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
96 |  |  |  |  | print STDERR "DynaLoader not linked into this perl\n"
97 |  |  |  |  | unless defined(&boot_DynaLoader);
98 |  |  |  |  | }
99 |  |  |  |  |
100 | 1 | 24µs |  |  | 1; # End of main code
101 |  |  |  |  |
102 |  |  |  |  |
103 |  |  |  |  | sub croak { require Carp; Carp::croak(@_) }
104 |  |  |  |  |
105 |  |  |  |  | sub bootstrap_inherit {
106 | 1 | 700ns |  |  | my $module = $_[0];
107 | 1 | 6µs |  |  | local *isa = *{"$module\::ISA"};
108 | 1 | 12µs |  |  | local @isa = (@isa, 'DynaLoader');
109 |  |  |  |  | # Cannot goto due to delocalization. Will report errors on a wrong line?
110 | 1 | 5µs | 1 | 457µs | bootstrap(@_); # spent 457µs making 1 call to DynaLoader::bootstrap
111 |  |  |  |  | }
112 |  |  |  |  |
113 |  |  |  |  | # The bootstrap function cannot be autoloaded (without complications)
114 |  |  |  |  | # so we define it here:
115 |  |  |  |  |
116 |  |  |  |  | # spent 3.05ms (613µs+2.44) within DynaLoader::bootstrap which was called 8 times, avg 381µs/call: # once (75µs+491µs) by DBI::BEGIN@161 at line 259 of DBI.pm # once (84µs+482µs) by DBI::install_driver at line 27 of DBD/SQLite.pm # once (72µs+385µs) by Moose::Exporter::BEGIN@13 at line 110 # once (82µs+229µs) by Log::Log4perl::Util::module_available at line 65 of Time/HiRes.pm # once (72µs+238µs) by List::MoreUtils::BEGIN@9 at line 36 of List/MoreUtils.pm # once (76µs+231µs) by SQL::Translator::Utils::BEGIN@24 at line 24 of Digest/SHA1.pm # once (84µs+204µs) by Data::OptList::BEGIN@10 at line 88 of Params/Util.pm # once (69µs+178µs) by Class::MOP::Mixin::HasMethods::BEGIN@17 at line 55 of Sub/Name.pm sub bootstrap {
117 |  |  |  |  | # use local vars to enable $module.bs script to edit values
118 | 8 | 19µs |  |  | local(@args) = @_;
119 | 8 | 6µs |  |  | local($module) = $args[0];
120 | 8 | 6µs |  |  | local(@dirs, $file);
121 |  |  |  |  |
122 | 8 | 3µs |  |  | unless ($module) {
123 |  |  |  |  | require Carp;
124 |  |  |  |  | Carp::confess("Usage: DynaLoader::bootstrap(module)");
125 |  |  |  |  | }
126 |  |  |  |  |
127 |  |  |  |  | # A common error on platforms which don't support dynamic loading.
128 |  |  |  |  | # Since it's fatal and potentially confusing we give a detailed message.
129 | 8 | 9µs |  |  | croak("Can't load module $module, dynamic loading not available in this perl.\n".
130 |  |  |  |  | " (You may need to build a new perl executable which either supports\n".
131 |  |  |  |  | " dynamic loading or has the $module module statically linked into it.)\n")
132 |  |  |  |  | unless defined(&dl_load_file);
133 |  |  |  |  |
- - |  |  |  |  |
136 | 8 | 26µs |  |  | my @modparts = split(/::/,$module);
137 | 8 | 7µs |  |  | my $modfname = $modparts[-1];
138 |  |  |  |  |
139 |  |  |  |  | # Some systems have restrictions on files names for DLL's etc.
140 |  |  |  |  | # mod2fname returns appropriate file base name (typically truncated)
141 |  |  |  |  | # It may also edit @modparts if required.
142 | 8 | 5µs |  |  | $modfname = &mod2fname(\@modparts) if defined &mod2fname;
143 |  |  |  |  |
144 |  |  |  |  |
145 |  |  |  |  |
146 | 8 | 12µs |  |  | my $modpname = join('/',@modparts);
147 |  |  |  |  |
148 | 8 | 5µs |  |  | print STDERR "DynaLoader::bootstrap for $module ",
149 |  |  |  |  | "(auto/$modpname/$modfname.$dl_dlext)\n"
150 |  |  |  |  | if $dl_debug;
151 |  |  |  |  |
152 | 8 | 13µs |  |  | foreach (@INC) {
153 |  |  |  |  |
154 |  |  |  |  |
155 | 18 | 16µs |  |  | my $dir = "$_/auto/$modpname";
156 |  |  |  |  |
157 |  |  |  |  |
158 | 18 | 133µs | 18 | 82µs | next unless -d $dir; # skip over uninteresting directories # spent 82µs making 18 calls to DynaLoader::CORE:ftdir, avg 5µs/call
159 |  |  |  |  |
160 |  |  |  |  | # check for common cases to avoid autoload of dl_findfile
161 | 8 | 17µs |  |  | my $try = "$dir/$modfname.$dl_dlext";
162 | 8 | 64µs | 8 | 26µs | last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try); # spent 26µs making 8 calls to DynaLoader::CORE:ftfile, avg 3µs/call
163 |  |  |  |  |
164 |  |  |  |  | # no luck here, save dir for possible later dl_findfile search
165 |  |  |  |  | push @dirs, $dir;
166 |  |  |  |  | }
167 |  |  |  |  | # last resort, let dl_findfile have a go in all known locations
168 | 8 | 3µs |  |  | $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
169 |  |  |  |  |
170 | 8 | 3µs |  |  | croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
171 |  |  |  |  | unless $file; # wording similar to error from 'require'
172 |  |  |  |  |
173 |  |  |  |  |
174 | 8 | 8µs |  |  | my $bootname = "boot_$module";
175 | 8 | 50µs | 8 | 28µs | $bootname =~ s/\W/_/g; # spent 28µs making 8 calls to DynaLoader::CORE:subst, avg 4µs/call
176 | 8 | 12µs |  |  | @dl_require_symbols = ($bootname);
177 |  |  |  |  |
178 |  |  |  |  | # Execute optional '.bootstrap' perl script for this module.
179 |  |  |  |  | # The .bs file can be used to configure @dl_resolve_using etc to
180 |  |  |  |  | # match the needs of the individual module on this architecture.
181 | 8 | 7µs |  |  | my $bs = $file;
182 | 8 | 297µs | 8 | 280µs | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library # spent 280µs making 8 calls to DynaLoader::CORE:subst, avg 35µs/call
183 | 8 | 49µs | 8 | 30µs | if (-s $bs) { # only read file if it's not empty # spent 30µs making 8 calls to DynaLoader::CORE:ftsize, avg 4µs/call
184 |  |  |  |  | print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
185 |  |  |  |  | eval { do $bs; };
186 |  |  |  |  | warn "$bs: $@\n" if $@;
187 |  |  |  |  | }
188 |  |  |  |  |
189 | 8 | 3µs |  |  | my $boot_symbol_ref;
190 |  |  |  |  |
191 |  |  |  |  |
192 |  |  |  |  |
193 |  |  |  |  | # Many dynamic extension loading problems will appear to come from
194 |  |  |  |  | # this section of code: XYZ failed at line 123 of DynaLoader.pm.
195 |  |  |  |  | # Often these errors are actually occurring in the initialisation
196 |  |  |  |  | # C code of the extension XS file. Perl reports the error as being
197 |  |  |  |  | # in this perl code simply because this was the last perl code
198 |  |  |  |  | # it executed.
199 |  |  |  |  |
200 | 8 | 998µs | 16 | 924µs | my $libref = dl_load_file($file, $module->dl_load_flags) or # spent 910µs making 8 calls to DynaLoader::dl_load_file, avg 114µs/call # spent 14µs making 8 calls to DynaLoader::dl_load_flags, avg 2µs/call
201 |  |  |  |  | croak("Can't load '$file' for module $module: ".dl_error());
202 |  |  |  |  |
203 | 8 | 11µs |  |  | push(@dl_librefs,$libref); # record loaded object
204 |  |  |  |  |
205 | 8 | 38µs | 8 | 12µs | my @unresolved = dl_undef_symbols(); # spent 12µs making 8 calls to DynaLoader::dl_undef_symbols, avg 1µs/call
206 | 8 | 4µs |  |  | if (@unresolved) {
207 |  |  |  |  | require Carp;
208 |  |  |  |  | Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
209 |  |  |  |  | }
210 |  |  |  |  |
211 | 8 | 46µs | 8 | 22µs | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or # spent 22µs making 8 calls to DynaLoader::dl_find_symbol, avg 3µs/call
212 |  |  |  |  | croak("Can't find '$bootname' symbol in $file\n");
213 |  |  |  |  |
214 | 8 | 8µs |  |  | push(@dl_modules, $module); # record loaded module
215 |  |  |  |  |
216 | 8 | 98µs | 8 | 66µs | boot: # spent 66µs making 8 calls to DynaLoader::dl_install_xsub, avg 8µs/call
217 |  |  |  |  | my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
218 |  |  |  |  |
219 |  |  |  |  | # See comment block above
220 |  |  |  |  |
221 | 8 | 10µs |  |  | push(@dl_shared_objects, $file); # record files loaded
222 |  |  |  |  |
223 | 8 | 1.05ms | 8 | 968µs | &$xs(@args); # spent 290µs making 1 call to DBI::bootstrap # spent 248µs making 1 call to DBD::SQLite::bootstrap # spent 211µs making 1 call to Moose::bootstrap # spent 74µs making 1 call to List::MoreUtils::bootstrap # spent 49µs making 1 call to Time::HiRes::bootstrap # spent 43µs making 1 call to Digest::SHA1::bootstrap # spent 36µs making 1 call to Params::Util::bootstrap # spent 17µs making 1 call to Sub::Name::bootstrap
224 |  |  |  |  | }
225 |  |  |  |  |
226 |  |  |  |  |
227 |  |  |  |  | #sub _check_file { # private utility to handle dl_expandspec vs -f tests
228 |  |  |  |  | # my($file) = @_;
229 |  |  |  |  | # return $file if (!$do_expand && -f $file); # the common case
230 |  |  |  |  | # return $file if ( $do_expand && ($file=dl_expandspec($file)));
231 |  |  |  |  | # return undef;
232 |  |  |  |  | #}
233 |  |  |  |  |
234 |  |  |  |  |
235 |  |  |  |  | # Let autosplit and the autoloader deal with these functions:
236 |  |  |  |  | __END__
|  |  |  |  | # spent 82µs within DynaLoader::CORE:ftdir which was called 18 times, avg 5µs/call: # 18 times (82µs+0s) by DynaLoader::bootstrap at line 158, avg 5µs/call sub DynaLoader::CORE:ftdir; # opcode
|  |  |  |  | # spent 26µs within DynaLoader::CORE:ftfile which was called 8 times, avg 3µs/call: # 8 times (26µs+0s) by DynaLoader::bootstrap at line 162, avg 3µs/call sub DynaLoader::CORE:ftfile; # opcode
|  |  |  |  | # spent 30µs within DynaLoader::CORE:ftsize which was called 8 times, avg 4µs/call: # 8 times (30µs+0s) by DynaLoader::bootstrap at line 183, avg 4µs/call sub DynaLoader::CORE:ftsize; # opcode
|  |  |  |  | # spent 309µs within DynaLoader::CORE:subst which was called 16 times, avg 19µs/call: # 8 times (280µs+0s) by DynaLoader::bootstrap at line 182, avg 35µs/call # 8 times (28µs+0s) by DynaLoader::bootstrap at line 175, avg 4µs/call sub DynaLoader::CORE:subst; # opcode
|  |  |  |  | # spent 22µs within DynaLoader::dl_find_symbol which was called 8 times, avg 3µs/call: # 8 times (22µs+0s) by DynaLoader::bootstrap at line 211, avg 3µs/call sub DynaLoader::dl_find_symbol; # xsub
|  |  |  |  | # spent 66µs within DynaLoader::dl_install_xsub which was called 8 times, avg 8µs/call: # 8 times (66µs+0s) by DynaLoader::bootstrap at line 216, avg 8µs/call sub DynaLoader::dl_install_xsub; # xsub
|  |  |  |  | # spent 910µs within DynaLoader::dl_load_file which was called 8 times, avg 114µs/call: # 8 times (910µs+0s) by DynaLoader::bootstrap at line 200, avg 114µs/call sub DynaLoader::dl_load_file; # xsub
|  |  |  |  | # spent 12µs within DynaLoader::dl_undef_symbols which was called 8 times, avg 1µs/call: # 8 times (12µs+0s) by DynaLoader::bootstrap at line 205, avg 1µs/call sub DynaLoader::dl_undef_symbols; # xsub