| Filename | /usr/share/perl/5.18/XSLoader.pm |
| Statements | Executed 2 statements in 97µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 22 | 22 | 22 | 5.92ms | 6.62ms | XSLoader::load (recurses: max depth 1, inclusive time 113µs) |
| 0 | 0 | 0 | 0s | 0s | XSLoader::bootstrap_inherit |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # Generated from XSLoader.pm.PL (resolved %Config::Config value) | ||||
| 2 | |||||
| 3 | package XSLoader; | ||||
| 4 | |||||
| 5 | $VERSION = "0.16"; | ||||
| 6 | |||||
| 7 | #use strict; | ||||
| 8 | |||||
| 9 | package DynaLoader; | ||||
| 10 | |||||
| 11 | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. | ||||
| 12 | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB | ||||
| 13 | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && | ||||
| 14 | !defined(&dl_error); | ||||
| 15 | package XSLoader; | ||||
| 16 | |||||
| 17 | # spent 6.62ms (5.92+700µs) within XSLoader::load which was called 22 times, avg 301µs/call:
# once (1.90ms+0s) by Module::Runtime::require_module at line 42 of Params/Validate/XS.pm
# once (241µs+813µs) by PONAPI::Server::BEGIN@14 at line 1492 of JSON/XS.pm
# once (496µs+0s) by B::BEGIN@17 at line 27 of B.pm
# once (414µs+0s) by PONAPI::Server::BEGIN@34 at line 36 of POSIX.pm
# once (290µs+0s) by PerlIO::import at line 4 of PerlIO/scalar.pm
# once (271µs+0s) by IO::Socket::BEGIN@12 at line 179 of Socket.pm
# once (215µs+0s) by HTTP::Body::BEGIN@25 at line 73 of Storable.pm
# once (203µs+0s) by File::stat::BEGIN@30 at line 11 of Fcntl.pm
# once (185µs+0s) by YAML::XS::BEGIN@19 at line 7 of YAML/XS/LibYAML.pm
# once (182µs+0s) by Scope::Upper::BEGIN@201 at line 203 of Scope/Upper.pm
# once (177µs+0s) by Moose::Util::TypeConstraints::BEGIN@621 at line 85 of re.pm
# once (171µs+0s) by IO::Handle::BEGIN@9 at line 11 of IO.pm
# once (147µs+0s) by Module::Pluggable::Object::BEGIN@4 at line 22 of List/Util.pm
# once (146µs+0s) by Data::Dumper::BEGIN@24 at line 34 of Data/Dumper.pm
# once (139µs+0s) by Plack::HTTPParser::try {...} at line 31 of HTTP/Parser/XS.pm
# once (128µs+0s) by Module::Runtime::require_module at line 21 of Package/Stash/XS.pm
# once (123µs+0s) by Module::Pluggable::Object::BEGIN@4 at line 80 of Cwd.pm
# once (116µs+0s) by Module::Runtime::require_module at line 17 of Class/Load/XS.pm
# once (113µs+0s) by Sub::Identify::BEGIN@6 at line 17 of Sub/Identify.pm
# once (104µs+0s) by MRO::Compat::BEGIN@10 at line 41 of mro.pm
# once (44µs+0s) by Moose::Exporter::BEGIN@8 at line 31 of Class/MOP.pm
# once (113µs+-113µs) by DynaLoader::BEGIN@92 at line 110 of attributes.pm | ||||
| 18 | package DynaLoader; | ||||
| 19 | |||||
| 20 | my ($module, $modlibname) = caller(); | ||||
| 21 | |||||
| 22 | if (@_) { | ||||
| 23 | $module = $_[0]; | ||||
| 24 | } else { | ||||
| 25 | $_[0] = $module; | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | # work with static linking too | ||||
| 29 | my $boots = "$module\::bootstrap"; | ||||
| 30 | goto &$boots if defined &$boots; | ||||
| 31 | |||||
| 32 | goto \&XSLoader::bootstrap_inherit unless $module and defined &dl_load_file; | ||||
| 33 | |||||
| 34 | my @modparts = split(/::/,$module); | ||||
| 35 | my $modfname = $modparts[-1]; | ||||
| 36 | |||||
| 37 | my $modpname = join('/',@modparts); | ||||
| 38 | my $c = @modparts; | ||||
| 39 | $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename | ||||
| 40 | my $file = "$modlibname/auto/$modpname/$modfname.so"; | ||||
| 41 | |||||
| 42 | # print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug; | ||||
| 43 | |||||
| 44 | my $bs = $file; | ||||
| 45 | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library | ||||
| 46 | |||||
| 47 | if (-s $bs) { # only read file if it's not empty | ||||
| 48 | # print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | ||||
| 49 | eval { do $bs; }; | ||||
| 50 | warn "$bs: $@\n" if $@; | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | goto \&XSLoader::bootstrap_inherit if not -f $file or -s $bs; | ||||
| 54 | |||||
| 55 | my $bootname = "boot_$module"; | ||||
| 56 | $bootname =~ s/\W/_/g; | ||||
| 57 | @DynaLoader::dl_require_symbols = ($bootname); | ||||
| 58 | |||||
| 59 | my $boot_symbol_ref; | ||||
| 60 | |||||
| 61 | # Many dynamic extension loading problems will appear to come from | ||||
| 62 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | ||||
| 63 | # Often these errors are actually occurring in the initialisation | ||||
| 64 | # C code of the extension XS file. Perl reports the error as being | ||||
| 65 | # in this perl code simply because this was the last perl code | ||||
| 66 | # it executed. | ||||
| 67 | |||||
| 68 | my $libref = dl_load_file($file, 0) or do { | ||||
| 69 | require Carp; | ||||
| 70 | Carp::croak("Can't load '$file' for module $module: " . dl_error()); | ||||
| 71 | }; | ||||
| 72 | push(@DynaLoader::dl_librefs,$libref); # record loaded object | ||||
| 73 | |||||
| 74 | my @unresolved = dl_undef_symbols(); | ||||
| 75 | if (@unresolved) { | ||||
| 76 | require Carp; | ||||
| 77 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do { | ||||
| 81 | require Carp; | ||||
| 82 | Carp::croak("Can't find '$bootname' symbol in $file\n"); | ||||
| 83 | }; | ||||
| 84 | |||||
| 85 | push(@DynaLoader::dl_modules, $module); # record loaded module | ||||
| 86 | |||||
| 87 | boot: | ||||
| 88 | my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file); | ||||
| 89 | |||||
| 90 | # See comment block above | ||||
| 91 | push(@DynaLoader::dl_shared_objects, $file); # record files loaded | ||||
| 92 | 2 | 97µs | 1 | 31µs | return &$xs(@_); # spent 31µs making 1 call to attributes::import |
| 93 | } | ||||
| 94 | |||||
| 95 | sub bootstrap_inherit { | ||||
| 96 | require DynaLoader; | ||||
| 97 | goto \&DynaLoader::bootstrap_inherit; | ||||
| 98 | } | ||||
| 99 | |||||
| 100 | 1; | ||||
| 101 | |||||
| 102 | __END__ | ||||
| 103 |