Filename | /usr/share/perl/5.18/Exporter.pm |
Statements | Executed 1404 statements in 12.3ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
90 | 88 | 53 | 11.0ms | 14.3ms | import | Exporter::
12 | 2 | 1 | 1.75ms | 1.86ms | as_heavy | Exporter::
1391 | 2 | 1 | 436µs | 436µs | CORE:subst (opcode) | Exporter::
1003 | 2 | 1 | 295µs | 295µs | CORE:match (opcode) | Exporter::
9 | 3 | 3 | 38µs | 1.86ms | export | Exporter::
3 | 1 | 1 | 15µs | 52µs | export_to_level | 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_tags | 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 | 9µs | require 5.006; | ||
4 | |||||
5 | # Be lean. | ||||
6 | #use strict; | ||||
7 | #no strict 'refs'; | ||||
8 | |||||
9 | 1 | 300ns | our $Debug = 0; | ||
10 | 1 | 100ns | our $ExportLevel = 0; | ||
11 | 1 | 200ns | our $Verbose ||= 0; | ||
12 | 1 | 300ns | our $VERSION = '5.68'; | ||
13 | 1 | 300ns | our (%Cache); | ||
14 | |||||
15 | sub as_heavy { | ||||
16 | 12 | 90µ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 | 12 | 27µs | my $c = (caller(1))[3]; | ||
20 | 12 | 72µs | 12 | 36µs | $c =~ s/.*:://; # spent 36µs making 12 calls to Exporter::CORE:subst, avg 3µs/call |
21 | 12 | 47µs | \&{"Exporter::Heavy::heavy_$c"}; | ||
22 | } | ||||
23 | |||||
24 | # spent 1.86ms (38µs+1.83) within Exporter::export which was called 9 times, avg 207µs/call:
# 4 times (20µs+1.78ms) by IO::Socket::import at line 36 of IO/Socket.pm, avg 451µs/call
# 3 times (10µs+21µs) by Exporter::Heavy::heavy_export_to_level at line 200 of Exporter/Heavy.pm, avg 10µs/call
# 2 times (8µs+21µs) by Exporter::import at line 62, avg 15µs/call | ||||
25 | 9 | 48µs | 18 | 7.37ms | goto &{as_heavy()}; # spent 5.55ms making 9 calls to Exporter::Heavy::heavy_export, avg 616µs/call
# spent 1.83ms making 9 calls to Exporter::as_heavy, avg 203µs/call |
26 | } | ||||
27 | |||||
28 | # spent 14.3ms (11.0+3.31) within Exporter::import which was called 90 times, avg 159µs/call:
# 3 times (1.67ms+2.80ms) by POSIX::import at line 30 of POSIX.pm, avg 1.49ms/call
# once (3.73ms+5µs) by main::BEGIN@123 at line 123 of flows_to_es.pl
# once (836µs+39µs) by IO::Socket::INET::BEGIN@12 at line 12 of IO/Socket/INET.pm
# once (577µs+100µs) by Moo::BEGIN@5 at line 5 of Moo.pm
# once (601µs+36µs) by IO::Socket::BEGIN@12 at line 12 of IO/Socket.pm
# once (381µs+29µs) by POSIX::BEGIN@11 at line 11 of POSIX.pm
# once (262µs+50µs) by HTTP::Tiny::Handle::BEGIN@981 at line 981 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (18µs+99µs) by Storable::BEGIN@52 at line 53 of Storable.pm
# once (101µs+7µs) by Search::Elasticsearch::Role::Serializer::JSON::BEGIN@8 at line 8 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Serializer/JSON.pm
# once (92µs+9µs) by Log::Any::BEGIN@11 at line 11 of /opt/flows/lib/lib/perl5/Log/Any.pm
# once (72µs+5µs) by JSON::MaybeXS::BEGIN@29 at line 31 of /opt/flows/lib/lib/perl5/JSON/MaybeXS.pm
# once (73µs+4µs) by Method::Generate::Accessor::BEGIN@4 at line 4 of Method/Generate/Accessor.pm
# once (67µs+4µs) by Moo::Role::BEGIN@4 at line 4 of Moo/Role.pm
# once (63µs+4µs) by Method::Generate::BuildAll::BEGIN@6 at line 6 of Method/Generate/BuildAll.pm
# once (62µs+4µs) by Sub::Defer::BEGIN@5 at line 5 of Sub/Defer.pm
# once (61µs+3µs) by Moo::BEGIN@4 at line 4 of Moo.pm
# once (58µs+4µs) by Method::Generate::Constructor::BEGIN@8 at line 8 of Method/Generate/Constructor.pm
# once (54µs+4µs) by main::BEGIN@8 at line 8 of flows_to_es.pl
# once (52µs+3µs) by Sub::Defer::BEGIN@6 at line 6 of Sub/Defer.pm
# once (53µs+2µs) by IO::Handle::BEGIN@6 at line 6 of IO/Handle.pm
# once (48µs+3µs) by File::Path::BEGIN@6 at line 6 of File/Path.pm
# once (47µs+3µs) by Search::Elasticsearch::Role::Cxn::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Cxn.pm
# once (44µs+2µs) by Sub::Quote::BEGIN@7 at line 7 of Sub/Quote.pm
# once (43µs+3µs) by InfluxDB::LineProtocol::BEGIN@9 at line 9 of /opt/flows/lib/lib/perl5/InfluxDB/LineProtocol.pm
# once (42µs+2µs) by IO::Handle::BEGIN@7 at line 7 of IO/Handle.pm
# once (40µs+2µs) by Search::Elasticsearch::Util::API::Path::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/Path.pm
# once (40µs+2µs) by Search::Elasticsearch::Role::Serializer::JSON::BEGIN@7 at line 7 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Serializer/JSON.pm
# once (40µs+2µs) by Search::Elasticsearch::Role::Transport::BEGIN@7 at line 7 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Transport.pm
# once (40µs+2µs) by SelectSaver::BEGIN@6 at line 6 of SelectSaver.pm
# once (39µs+2µs) by Class::XSAccessor::Heavy::BEGIN@7 at line 7 of Class/XSAccessor/Heavy.pm
# once (39µs+2µs) by main::BEGIN@10 at line 10 of flows_to_es.pl
# once (38µs+2µs) by URI::_idna::BEGIN@7 at line 7 of URI/_idna.pm
# once (39µs+2µs) by Search::Elasticsearch::Transport::BEGIN@7 at line 7 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Transport.pm
# once (38µs+3µs) by main::BEGIN@124 at line 124 of flows_to_es.pl
# once (38µs+2µs) by Tie::Hash::BEGIN@5 at line 5 of Tie/Hash.pm
# once (38µs+2µs) by namespace::clean::BEGIN@38 at line 38 of /opt/flows/lib/lib/perl5/namespace/clean.pm
# once (37µs+2µs) by Try::Tiny::BEGIN@15 at line 15 of Try/Tiny.pm
# once (37µs+2µs) by Data::Dumper::BEGIN@22 at line 22 of Data/Dumper.pm
# once (36µs+3µs) by URI::_server::BEGIN@6 at line 6 of URI/_server.pm
# once (37µs+2µs) by Sub::Install::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/Sub/Install.pm
# once (37µs+2µs) by Search::Elasticsearch::Role::Logger::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Logger.pm
# once (36µs+2µs) by Method::Generate::Constructor::BEGIN@4 at line 4 of Method/Generate/Constructor.pm
# once (36µs+2µs) by Search::Elasticsearch::Bulk::BEGIN@7 at line 7 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Bulk.pm
# once (36µs+2µs) by Log::Any::Adapter::Base::BEGIN@10 at line 10 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Base.pm
# once (36µs+2µs) by Socket::BEGIN@10 at line 10 of Socket.pm
# once (36µs+2µs) by IO::Socket::UNIX::BEGIN@12 at line 12 of IO/Socket/UNIX.pm
# once (35µs+2µs) by Method::Generate::BuildAll::BEGIN@5 at line 5 of Method/Generate/BuildAll.pm
# once (36µs+2µs) by IO::BEGIN@6 at line 6 of IO.pm
# once (35µs+2µs) by main::BEGIN@125 at line 125 of flows_to_es.pl
# once (34µs+2µs) by Search::Elasticsearch::Role::Client::Direct::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Client/Direct.pm
# once (35µs+2µs) by main::BEGIN@11 at line 11 of flows_to_es.pl
# once (34µs+2µs) by Method::Generate::Constructor::BEGIN@6 at line 6 of Method/Generate/Constructor.pm
# once (34µs+2µs) by IO::Socket::INET::BEGIN@13 at line 13 of IO/Socket/INET.pm
# once (34µs+2µs) by Method::Generate::Accessor::BEGIN@6 at line 6 of Method/Generate/Accessor.pm
# once (34µs+2µs) by IO::Socket::BEGIN@13 at line 13 of IO/Socket.pm
# once (33µs+2µs) by SelectSaver::BEGIN@7 at line 7 of SelectSaver.pm
# once (33µs+2µs) by Module::Implementation::BEGIN@13 at line 13 of Module/Implementation.pm
# once (33µs+2µs) by Search::Elasticsearch::Role::Cxn::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Cxn.pm
# once (31µs+2µs) by Encode::BEGIN@47 at line 47 of Encode.pm
# once (31µs+1µs) by namespace::clean::BEGIN@11 at line 38 of Sub/Exporter/Progressive.pm
# once (30µs+2µs) by main::BEGIN@381 at line 381 of flows_to_es.pl
# once (30µs+1µs) by Class::XSAccessor::BEGIN@5 at line 5 of Class/XSAccessor.pm
# once (29µs+1µs) by Sub::Quote::BEGIN@8 at line 8 of Sub/Quote.pm
# once (28µs+1µs) by HTTP::Tiny::Handle::BEGIN@983 at line 983 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (28µs+1µs) by Data::OptList::BEGIN@7 at line 95 of /opt/flows/lib/lib/perl5/x86_64-linux-gnu-thread-multi/Params/Util.pm
# once (28µs+1µs) by Search::Elasticsearch::Util::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util.pm
# once (28µs+1µs) by main::BEGIN@9 at line 9 of flows_to_es.pl
# once (27µs+1µs) by Sub::Quote::BEGIN@9 at line 9 of Sub/Quote.pm
# once (26µs+1µs) by URI::_generic::BEGIN@7 at line 7 of URI/_generic.pm
# once (26µs+1µs) by URI::_idna::BEGIN@8 at line 8 of URI/_idna.pm
# once (26µs+1µs) by URI::_query::BEGIN@5 at line 5 of URI/_query.pm
# once (26µs+1µs) by Method::Generate::Accessor::BEGIN@8 at line 8 of Method/Generate/Accessor.pm
# once (25µs+1µs) by Search::Elasticsearch::Role::CxnPool::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/CxnPool.pm
# once (24µs+1µs) by Try::Tiny::BEGIN@1 at line 1 of (eval 7)[Try/Tiny.pm:18]
# once (23µs+1µs) by Method::Generate::BuildAll::BEGIN@7 at line 7 of Method/Generate/BuildAll.pm
# once (23µs+1µs) by Method::Generate::Constructor::BEGIN@7 at line 7 of Method/Generate/Constructor.pm
# once (22µs+900ns) by Method::Generate::Accessor::BEGIN@7 at line 7 of Method/Generate/Accessor.pm
# once (21µs+0s) by Cwd::BEGIN@4 at line 4 of Cwd.pm
# once (21µs+0s) by IO::Socket::BEGIN@11 at line 11 of IO/Socket.pm
# once (20µs+0s) by IO::Socket::BEGIN@17 at line 17 of IO/Socket.pm
# once (18µs+0s) by Log::Any::Adapter::Util::BEGIN@10 at line 10 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Util.pm
# once (18µs+0s) by JSON::XS::BEGIN@121 at line 121 of JSON/XS.pm
# once (17µs+0s) by IO::Socket::INET::BEGIN@15 at line 15 of IO/Socket/INET.pm
# once (15µs+0s) by IO::Socket::BEGIN@16 at line 16 of IO/Socket.pm
# once (14µs+0s) by IO::Socket::INET::BEGIN@14 at line 14 of IO/Socket/INET.pm
# once (9µs+0s) by Encode::BEGIN@12 at line 12 of Encode.pm
# once (7µs+0s) by Try::Tiny::BEGIN@12 at line 12 of Try/Tiny.pm
# once (6µs+0s) by Encode::Alias::BEGIN@8 at line 8 of Encode/Alias.pm | ||||
29 | 90 | 45µs | my $pkg = shift; | ||
30 | 90 | 60µs | my $callpkg = caller($ExportLevel); | ||
31 | |||||
32 | 90 | 36µs | if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { | ||
33 | 3 | 11µs | *{$callpkg."::import"} = \&import; | ||
34 | 3 | 21µs | return; | ||
35 | } | ||||
36 | |||||
37 | # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( | ||||
38 | 87 | 164µ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 | 87 | 99µs | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||
42 | 87 | 36µs | return export $pkg, $callpkg, @_ | ||
43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
44 | 87 | 73µs | my $export_cache = ($Cache{$pkg} ||= {}); | ||
45 | 87 | 183µs | my $args = @_ or @_ = @$exports; | ||
46 | |||||
47 | 87 | 33µs | if ($args and not %$export_cache) { | ||
48 | s/^&//, $export_cache->{$_} = 1 | ||||
49 | 21 | 6.50ms | 1379 | 400µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"}); # spent 400µs making 1379 calls to Exporter::CORE:subst, avg 290ns/call |
50 | } | ||||
51 | 87 | 10µ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 | 87 | 50µ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 | 51 | 747µs | 300 | 116µs | foreach (@_); # spent 116µs making 300 calls to Exporter::CORE:match, avg 387ns/call |
58 | } else { | ||||
59 | ($heavy = /\W/) and last | ||||
60 | 36 | 1.21ms | 703 | 179µs | foreach (@_); # spent 179µs making 703 calls to Exporter::CORE:match, avg 254ns/call |
61 | } | ||||
62 | 87 | 45µs | 2 | 29µs | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; # spent 29µs making 2 calls to Exporter::export, avg 15µs/call |
63 | local $SIG{__WARN__} = | ||||
64 | 85 | 408µs | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||
65 | # shortcut for the common case of no type character | ||||
66 | 85 | 2.23ms | *{"$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 | # spent 52µs (15+37) within Exporter::export_to_level which was called 3 times, avg 17µs/call:
# 3 times (15µs+37µs) by Time::HiRes::import at line 63 of Time/HiRes.pm, avg 17µs/call | ||||
81 | 3 | 19µs | 6 | 312µs | goto &{as_heavy()}; # spent 275µs making 3 calls to Exporter::Heavy::heavy_export_to_level, avg 92µs/call
# spent 37µs making 3 calls to Exporter::as_heavy, avg 12µs/call |
82 | } | ||||
83 | |||||
84 | sub export_tags { | ||||
85 | goto &{as_heavy()}; | ||||
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 | 4µs | 1; | ||
97 | __END__ | ||||
sub Exporter::CORE:match; # opcode | |||||
sub Exporter::CORE:subst; # opcode |