← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:11 2010

File /usr/lib/perl/5.10/DynaLoader.pm
Statements Executed 400
Total Time 0.0060106 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10121.75ms1.75msDynaLoader::::dl_load_fileDynaLoader::dl_load_file(xsub)
9991.14ms4.58msDynaLoader::::bootstrapDynaLoader::bootstrap
1012106µs106µsDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub(xsub)
101256µs56µsDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol(xsub)
91154µs54µsDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
101233µs33µsDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols(xsub)
0000s0sDynaLoader::::BEGINDynaLoader::BEGIN
0000s0sDynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0000s0sDynaLoader::::croakDynaLoader::croak
LineStmts.Exclusive
Time
Avg.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
17BEGIN {
1811µs1µs $VERSION = '1.08';
19147µs47µs}
20
21185µs85µsrequire AutoLoader;
2214µs4µs*AUTOLOAD = \&AutoLoader::AUTOLOAD;
23
2431.23ms409µsuse Config;
# spent 27µs making 1 call to Config::import
25
26# enable debug/trace messages from DynaLoader perl code
2712µs2µs$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
28
29#
30# Flags to alter dl_load_file behaviour. Assigned bits:
31# 0x01 make symbols available for linking later dl_load_file's.
32# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
33# (ignored under VMS; effect is built-in to image linking)
34#
35# This is called as a class method $module->dl_load_flags. The
36# definition here will be inherited and result on "default" loading
37# behaviour unless a sub-class of DynaLoader defines its own version.
38#
39
40915µs2µs
# spent 54µs within DynaLoader::dl_load_flags which was called 9 times, avg 6µs/call: # 9 times (54µs+0s) by DynaLoader::bootstrap at line 196, avg 6µs/call
sub dl_load_flags { 0x00 }
41
42# ($dl_dlext, $dlsrc)
43# = @Config::Config{'dlext', 'dlsrc'};
4412µs2µs ($dl_dlext, $dlsrc) = ('so', 'dl_dlopen.xs')
45;
46
471400ns400ns$do_expand = 0;
48
491700ns700ns@dl_require_symbols = (); # names of symbols we need
501400ns400ns@dl_resolve_using = (); # names of files to link with
511400ns400ns@dl_library_path = (); # path to look for files
52
53#XSLoader.pm may have added elements before we were required
54#@dl_shared_objects = (); # shared objects for symbols we have
55#@dl_librefs = (); # things we have loaded
56#@dl_modules = (); # Modules we have loaded
57
58# This is a fix to support DLD's unfortunate desire to relink -lc
591500ns500ns@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
60
61# Initialise @dl_library_path with the 'standard' library path
62# for this platform as determined by Configure.
63
64124µs24µspush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 9µs making 1 call to Config::FETCH
65
66110µs10µsmy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 9µs making 1 call to Config::FETCH
67111µs11µsmy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 6µs making 1 call to Config::FETCH
6816µs6µsmy $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
7319µs9µ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
801600ns600nsif ($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# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
87# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
8811µs1µsboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
89 !defined(&dl_error);
90
911300ns300nsif ($dl_debug) {
92 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
93 print STDERR "DynaLoader not linked into this perl\n"
94 unless defined(&boot_DynaLoader);
95}
96
97125µs25µs1; # End of main code
98
99sub croak { require Carp; Carp::croak(@_) }
100
101sub bootstrap_inherit {
10211µs1µs my $module = $_[0];
10317µs7µs local *isa = *{"$module\::ISA"};
104111µs11µs local @isa = (@isa, 'DynaLoader');
105 # Cannot goto due to delocalization. Will report errors on a wrong line?
106110µs10µs bootstrap(@_);
# spent 266µs making 1 call to DynaLoader::bootstrap
107}
108
109# The bootstrap function cannot be autoloaded (without complications)
110# so we define it here:
111
112
# spent 4.58ms (1.14+3.44) within DynaLoader::bootstrap which was called 9 times, avg 509µs/call: # once (112µs+1.14ms) by XML::LibXML::BEGIN at line 113 of /usr/lib/perl5/XML/LibXML.pm # once (164µs+771µs) at line 42 of /usr/lib/perl/5.10/Unicode/Normalize.pm # once (134µs+412µs) at line 19 of /usr/lib/perl5/XML/LibXML/Common.pm # once (151µs+216µs) at line 65 of /usr/lib/perl/5.10/Time/HiRes.pm # once (119µs+213µs) at line 24 of /usr/lib/perl5/List/MoreUtils.pm # once (121µs+209µs) at line 67 of /usr/local/lib/perl/5.10.0/Storable.pm # once (124µs+183µs) at line 88 of /usr/local/lib/perl/5.10.0/Params/Util.pm # once (102µs+164µs) by DynaLoader::bootstrap_inherit at line 106 # once (112µs+131µs) at line 55 of /usr/local/lib/perl/5.10.0/Sub/Name.pm
sub bootstrap {
113 # use local vars to enable $module.bs script to edit values
114932µs4µs local(@args) = @_;
115911µs1µs local($module) = $args[0];
11698µs922ns local(@dirs, $file);
117
11893µs367ns unless ($module) {
119 require Carp;
120 Carp::confess("Usage: DynaLoader::bootstrap(module)");
121 }
122
123 # A common error on platforms which don't support dynamic loading.
124 # Since it's fatal and potentially confusing we give a detailed message.
12599µs978ns croak("Can't load module $module, dynamic loading not available in this perl.\n".
126 " (You may need to build a new perl executable which either supports\n".
127 " dynamic loading or has the $module module statically linked into it.)\n")
128 unless defined(&dl_load_file);
129
130
131935µs4µs my @modparts = split(/::/,$module);
132911µs1µs my $modfname = $modparts[-1];
133
134 # Some systems have restrictions on files names for DLL's etc.
135 # mod2fname returns appropriate file base name (typically truncated)
136 # It may also edit @modparts if required.
13797µs744ns $modfname = &mod2fname(\@modparts) if defined &mod2fname;
138
139
140
141915µs2µs my $modpname = join('/',@modparts);
142
14396µs611ns print STDERR "DynaLoader::bootstrap for $module ",
144 "(auto/$modpname/$modfname.so)\n"
145 if $dl_debug;
146
147919µs2µs foreach (@INC) {
148
149
1504131µs756ns my $dir = "$_/auto/$modpname";
151
152
15341198µs5µs next unless -d $dir; # skip over uninteresting directories
154
155 # check for common cases to avoid autoload of dl_findfile
1561013µs1µs my $try = "$dir/$modfname.so";
1571052µs5µs last if $file = (-f $try) && $try;
158
159
160 # no luck here, save dir for possible later dl_findfile search
16112µs2µs push @dirs, $dir;
162 }
163 # last resort, let dl_findfile have a go in all known locations
16494µs389ns $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
165
16694µs422ns 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
170911µs1µs my $bootname = "boot_$module";
171934µs4µs $bootname =~ s/\W/_/g;
172916µs2µ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.
17795µs556ns my $bs = $file;
1789322µs36µs $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
179940µs4µs if (-s $bs) { # only read file if it's not empty
180 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
181 eval { do $bs; };
182 warn "$bs: $@\n" if $@;
183 }
184
18593µs378ns 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
19691.86ms206µs my $libref = dl_load_file($file, $module->dl_load_flags) or
# spent 1.75ms making 9 calls to DynaLoader::dl_load_file, avg 194µs/call # spent 54µs making 9 calls to DynaLoader::dl_load_flags, avg 6µs/call
197 croak("Can't load '$file' for module $module: ".dl_error());
198
199914µs2µs push(@dl_librefs,$libref); # record loaded object
200
201949µs5µs my @unresolved = dl_undef_symbols();
# spent 33µs making 9 calls to DynaLoader::dl_undef_symbols, avg 4µs/call
20295µs556ns if (@unresolved) {
203 require Carp;
204 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
205 }
206
207966µs7µs $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 56µs making 9 calls to DynaLoader::dl_find_symbol, avg 6µs/call
208 croak("Can't find '$bootname' symbol in $file\n");
209
210912µs1µs push(@dl_modules, $module); # record loaded module
211
2129125µs14µs boot:
# spent 106µs making 9 calls to DynaLoader::dl_install_xsub, avg 12µs/call
213 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
214
215 # See comment block above
216
217911µs1µs push(@dl_shared_objects, $file); # record files loaded
218
21991.48ms165µs &$xs(@args);
# spent 896µs making 1 call to XML::LibXML::bootstrap # spent 114µs making 1 call to Unicode::Normalize::bootstrap # spent 99µs making 1 call to List::MoreUtils::bootstrap # spent 93µs making 1 call to Storable::bootstrap # spent 81µs making 1 call to Time::HiRes::bootstrap # spent 48µs making 1 call to XML::LibXML::Common::bootstrap # spent 45µs making 1 call to Params::Util::bootstrap # spent 36µs making 1 call to Moose::bootstrap # spent 33µs making 1 call to Sub::Name::bootstrap
220}
221
222#sub _check_file { # private utility to handle dl_expandspec vs -f tests
223# my($file) = @_;
224# return $file if (!$do_expand && -f $file); # the common case
225# return $file if ( $do_expand && ($file=dl_expandspec($file)));
226# return undef;
227#}
228
229# Let autosplit and the autoloader deal with these functions:
# spent 56µs within DynaLoader::dl_find_symbol which was called 9 times, avg 6µs/call: # 9 times (56µs+0s) by DynaLoader::bootstrap at line 207 of /usr/lib/perl/5.10/DynaLoader.pm, avg 6µs/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 106µs within DynaLoader::dl_install_xsub which was called 9 times, avg 12µs/call: # 9 times (106µs+0s) by DynaLoader::bootstrap at line 212 of /usr/lib/perl/5.10/DynaLoader.pm, avg 12µs/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 1.75ms within DynaLoader::dl_load_file which was called 9 times, avg 194µs/call: # 9 times (1.75ms+0s) by DynaLoader::bootstrap at line 196 of /usr/lib/perl/5.10/DynaLoader.pm, avg 194µs/call
sub DynaLoader::dl_load_file; # xsub
# spent 33µs within DynaLoader::dl_undef_symbols which was called 9 times, avg 4µs/call: # 9 times (33µs+0s) by DynaLoader::bootstrap at line 201 of /usr/lib/perl/5.10/DynaLoader.pm, avg 4µs/call
sub DynaLoader::dl_undef_symbols; # xsub