Filename | /usr/share/perl5/vendor_perl/Exporter.pm |
Statements | Executed 1309 statements in 4.35ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
80 | 58 | 34 | 3.37ms | 6.31ms | import | Exporter::
28 | 2 | 1 | 2.71ms | 2.83ms | as_heavy | Exporter::
26 | 1 | 1 | 190µs | 531µs | export | Exporter::
2 | 2 | 2 | 25µs | 2.51ms | export_tags | Exporter::
0 | 0 | 0 | 0s | 0s | __ANON__[:64] | Exporter::
0 | 0 | 0 | 0s | 0s | export_fail | Exporter::
0 | 0 | 0 | 0s | 0s | export_ok_tags | Exporter::
0 | 0 | 0 | 0s | 0s | export_to_level | Exporter::
0 | 0 | 0 | 0s | 0s | require_version | Exporter::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Exporter; | ||||
2 | |||||
3 | 1 | 38µs | require 5.006; | ||
4 | |||||
5 | # Be lean. | ||||
6 | #use strict; | ||||
7 | #no strict 'refs'; | ||||
8 | |||||
9 | 1 | 700ns | our $Debug = 0; | ||
10 | 1 | 200ns | our $ExportLevel = 0; | ||
11 | 1 | 800ns | our $Verbose ||= 0; | ||
12 | 1 | 800ns | our $VERSION = '5.68'; | ||
13 | 1 | 600ns | our (%Cache); | ||
14 | |||||
15 | sub as_heavy { | ||||
16 | 28 | 142µs | require Exporter::Heavy; | ||
17 | # Unfortunately, this does not work if the caller is aliased as *name = \&foo | ||||
18 | # Thus the need to create a lot of identical subroutines | ||||
19 | 28 | 164µs | my $c = (caller(1))[3]; | ||
20 | 28 | 88µs | $c =~ s/.*:://; | ||
21 | 28 | 198µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 531µs (190+341) within Exporter::export which was called 26 times, avg 20µs/call:
# 26 times (190µs+341µs) by Exporter::import at line 62, avg 20µs/call | ||||
25 | 26 | 168µs | 52 | 2.75ms | goto &{as_heavy()}; # spent 2.41ms making 26 calls to Exporter::Heavy::heavy_export, avg 93µs/call
# spent 341µs making 26 calls to Exporter::as_heavy, avg 13µs/call |
26 | } | ||||
27 | |||||
28 | # spent 6.31ms (3.37+2.94) within Exporter::import which was called 80 times, avg 79µs/call:
# 23 times (626µs+2.41ms) by Error::import at line 63 of Error.pm, avg 132µs/call
# once (424µs+135µs) by POSIX::import at line 30 of POSIX.pm
# once (20µs+320µs) by Foswiki::Store::VC::Handler::BEGIN@34 at line 34 of /var/www/foswiki11/lib/Foswiki/Store/VC/Handler.pm
# once (207µs+0s) by POSIX::BEGIN@11 at line 11 of POSIX.pm
# once (182µs+0s) by File::Temp::BEGIN@14 at line 14 of File/Temp.pm
# once (119µs+0s) by Foswiki::Meta::BEGIN@117 at line 117 of /var/www/foswiki11/lib/Foswiki/Meta.pm
# once (108µs+0s) by Foswiki::Request::BEGIN@37 at line 147 of IO/File.pm
# once (104µs+0s) by Foswiki::Plugins::WysiwygPlugin::Constants::BEGIN@7 at line 7 of /var/www/foswiki11/lib/Foswiki/Plugins/WysiwygPlugin/Constants.pm
# once (21µs+76µs) by Storable::BEGIN@53 at line 54 of Storable.pm
# once (95µs+0s) by I18N::LangTags::Detect::BEGIN@16 at line 16 of I18N/LangTags/Detect.pm
# once (82µs+0s) by CGI::BEGIN@28 at line 28 of CGI.pm
# once (68µs+0s) by CGI::Carp::import at line 370 of CGI/Carp.pm
# once (67µs+0s) by Data::Dumper::BEGIN@22 at line 22 of Data/Dumper.pm
# once (56µs+0s) by CGI::Carp::BEGIN@332 at line 332 of CGI/Carp.pm
# once (44µs+0s) by Foswiki::BEGIN@28 at line 28 of setlib.cfg
# once (43µs+0s) by Foswiki::Plugins::DirectedGraphPlugin::BEGIN@31 at line 31 of /var/www/foswiki11/lib/Foswiki/Plugins/DirectedGraphPlugin.pm
# once (40µs+0s) by CGI::BEGIN@3 at line 3 of CGI.pm
# once (40µs+0s) by Foswiki::Plugins::WysiwygPlugin::Constants::BEGIN@8 at line 8 of /var/www/foswiki11/lib/Foswiki/Plugins/WysiwygPlugin/Constants.pm
# once (39µs+0s) by Time::ParseDate::BEGIN@7 at line 7 of Time/ParseDate.pm
# once (38µs+0s) by IO::BEGIN@6 at line 6 of IO.pm
# once (36µs+0s) by IO::Seekable::BEGIN@98 at line 98 of IO/Seekable.pm
# once (34µs+0s) by Foswiki::Plugins::DirectedGraphPlugin::BEGIN@197 at line 197 of /var/www/foswiki11/lib/Foswiki/Plugins/DirectedGraphPlugin.pm
# once (33µs+0s) by Time::Local::BEGIN@4 at line 4 of Time/Local.pm
# once (32µs+0s) by Tie::Hash::BEGIN@188 at line 188 of Tie/Hash.pm
# once (32µs+0s) by Time::ParseDate::BEGIN@6 at line 6 of Time/ParseDate.pm
# once (32µs+0s) by IO::File::BEGIN@131 at line 131 of IO/File.pm
# once (30µs+0s) by IO::File::BEGIN@130 at line 130 of IO/File.pm
# once (30µs+0s) by File::Temp::BEGIN@17 at line 17 of File/Temp.pm
# once (30µs+0s) by Foswiki::MetaCache::BEGIN@23 at line 23 of /var/www/foswiki11/lib/Foswiki/MetaCache.pm
# once (30µs+0s) by Foswiki::Users::BaseUserMapping::BEGIN@38 at line 38 of /var/www/foswiki11/lib/Foswiki/Users/BaseUserMapping.pm
# once (30µs+0s) by IO::Handle::BEGIN@263 at line 263 of IO/Handle.pm
# once (30µs+0s) by SelectSaver::BEGIN@38 at line 38 of SelectSaver.pm
# once (29µs+0s) by CGI::Cookie::BEGIN@21 at line 21 of CGI/Cookie.pm
# once (28µs+0s) by IO::Handle::BEGIN@264 at line 264 of IO/Handle.pm
# once (27µs+0s) by File::Temp::BEGIN@10 at line 10 of File/Temp.pm
# once (25µs+0s) by Time::ParseDate::BEGIN@5 at line 5 of Time/ParseDate.pm
# once (25µs+0s) by Foswiki::Users::BaseUserMapping::BEGIN@39 at line 39 of /var/www/foswiki11/lib/Foswiki/Users/BaseUserMapping.pm
# once (25µs+0s) by SelectSaver::BEGIN@39 at line 39 of SelectSaver.pm
# once (25µs+0s) by Foswiki::Plugins::TimeCalcPlugin::BEGIN@38 at line 38 of /var/www/foswiki11/lib/Foswiki/Plugins/TimeCalcPlugin.pm
# once (25µs+0s) by Foswiki::Plugins::PlantUMLPlugin::BEGIN@11 at line 11 of /var/www/foswiki11/lib/Foswiki/Plugins/PlantUMLPlugin.pm
# once (24µs+0s) by File::Temp::BEGIN@13 at line 13 of File/Temp.pm
# once (24µs+0s) by IO::Seekable::BEGIN@104 at line 104 of IO/Seekable.pm
# once (24µs+0s) by Time::JulianDay::BEGIN@5 at line 5 of Time/JulianDay.pm
# once (24µs+0s) by IO::File::BEGIN@133 at line 133 of IO/File.pm
# once (23µs+0s) by Time::Timezone::BEGIN@10 at line 10 of Time/Timezone.pm
# once (22µs+0s) by Foswiki::Plugins::DirectedGraphPlugin::BEGIN@30 at line 30 of /var/www/foswiki11/lib/Foswiki/Plugins/DirectedGraphPlugin.pm
# once (22µs+0s) by Time::JulianDay::BEGIN@6 at line 6 of Time/JulianDay.pm
# once (21µs+0s) by Assert::BEGIN@20 at line 20 of /var/www/foswiki11/lib/Assert.pm
# once (21µs+0s) by File::Temp::Dir::BEGIN@1573 at line 1573 of File/Temp.pm
# once (21µs+0s) by Foswiki::Plugins::PlantUMLPlugin::BEGIN@10 at line 10 of /var/www/foswiki11/lib/Foswiki/Plugins/PlantUMLPlugin.pm
# once (20µs+0s) by Encode::BEGIN@48 at line 48 of Encode.pm
# once (20µs+0s) by Cwd::BEGIN@171 at line 171 of Cwd.pm
# once (19µs+0s) by Time::JulianDay::BEGIN@30 at line 30 of Time/JulianDay.pm
# once (19µs+0s) by Foswiki::Request::BEGIN@38 at line 38 of /var/www/foswiki11/lib/Foswiki/Request.pm
# once (19µs+0s) by File::Temp::BEGIN@15 at line 15 of File/Temp.pm
# once (18µs+0s) by File::Path::BEGIN@6 at line 6 of File/Path.pm
# once (13µs+0s) by Crypt::PasswdMD5::BEGIN@65 at line 65 of Crypt/PasswdMD5.pm
# once (10µs+0s) by File::Temp::BEGIN@16 at line 16 of File/Temp.pm | ||||
29 | 80 | 53µs | my $pkg = shift; | ||
30 | 80 | 241µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 80 | 41µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | *{$callpkg."::import"} = \&import; | ||||
34 | return; | ||||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 80 | 179µs | my $exports = \@{"$pkg\::EXPORT"}; | ||
39 | # But, avoid creating things if they don't exist, which saves a couple of | ||||
40 | # hundred bytes per package processed. | ||||
41 | 80 | 142µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 80 | 51µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 80 | 77µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 80 | 97µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 80 | 38µs | if ($args and not %$export_cache) { | ||
48 | s/^&//, $export_cache->{$_} = 1 | ||||
49 | 14 | 721µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); | ||
50 | } | ||||
51 | 80 | 12µs | my $heavy; | ||
52 | # Try very hard not to use {} and hence have to enter scope on the foreach | ||||
53 | # We bomb out of the loop with last as soon as heavy is set. | ||||
54 | 80 | 43µs | if ($args or $fail) { | ||
55 | ($heavy = (/\W/ or $args and not exists $export_cache->{$_} | ||||
56 | or $fail and @$fail and $_ eq $fail->[0])) and last | ||||
57 | 61 | 323µs | foreach (@_); | ||
58 | } else { | ||||
59 | ($heavy = /\W/) and last | ||||
60 | 19 | 80µs | foreach (@_); | ||
61 | } | ||||
62 | 80 | 173µs | 26 | 531µs | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 531µs making 26 calls to Exporter::export, avg 20µs/call |
63 | local $SIG{__WARN__} = | ||||
64 | 54 | 75µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
65 | # shortcut for the common case of no type character | ||||
66 | 54 | 1.17ms | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||
67 | } | ||||
68 | |||||
69 | # Default methods | ||||
70 | |||||
71 | sub export_fail { | ||||
72 | my $self = shift; | ||||
73 | @_; | ||||
74 | } | ||||
75 | |||||
76 | # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as | ||||
77 | # *name = \&foo. Thus the need to create a lot of identical subroutines | ||||
78 | # Otherwise we could have aliased them to export(). | ||||
79 | |||||
80 | sub export_to_level { | ||||
81 | goto &{as_heavy()}; | ||||
82 | } | ||||
83 | |||||
84 | # spent 2.51ms (25µs+2.49) within Exporter::export_tags which was called 2 times, avg 1.26ms/call:
# once (17µs+2.47ms) by Foswiki::BEGIN@46 at line 30 of /var/www/foswiki11/lib/Assert.pm
# once (8µs+13µs) by Foswiki::Sandbox::BEGIN@37 at line 72 of File/Temp.pm | ||||
85 | 2 | 25µs | 4 | 2.54ms | goto &{as_heavy()}; # spent 2.49ms making 2 calls to Exporter::as_heavy, avg 1.24ms/call
# spent 57µs making 2 calls to Exporter::Heavy::heavy_export_tags, avg 29µs/call |
86 | } | ||||
87 | |||||
88 | sub export_ok_tags { | ||||
89 | goto &{as_heavy()}; | ||||
90 | } | ||||
91 | |||||
92 | sub require_version { | ||||
93 | goto &{as_heavy()}; | ||||
94 | } | ||||
95 | |||||
96 | 1 | 9µs | 1; | ||
97 | __END__ |