← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Fri Aug 4 10:15:59 2017
Reported on Fri Aug 4 10:16:18 2017

Filename/usr/libdata/perl5/Exporter.pm
StatementsExecuted 274 statements in 2.03ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1818101.60ms3.58msExporter::::importExporter::import
2111.51ms1.60msExporter::::as_heavyExporter::as_heavy
17421115µs115µsExporter::::CORE:substExporter::CORE:subst (opcode)
1122190µs90µsExporter::::CORE:matchExporter::CORE:match (opcode)
21114µs1.61msExporter::::exportExporter::export
0000s0sExporter::::__ANON__[:64]Exporter::__ANON__[:64]
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::export_tagsExporter::export_tags
0000s0sExporter::::export_to_levelExporter::export_to_level
0000s0sExporter::::require_versionExporter::require_version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Exporter;
2
318µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91700nsour $Debug = 0;
101600nsour $ExportLevel = 0;
111700nsour $Verbose ||= 0;
121800nsour $VERSION = '5.72';
13our (%Cache);
14
15
# spent 1.60ms (1.51+92µs) within Exporter::as_heavy which was called 2 times, avg 800µs/call: # 2 times (1.51ms+92µs) by Exporter::export at line 25, avg 800µs/call
sub as_heavy {
162130µ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
1928µs my $c = (caller(1))[3];
20216µs27µs $c =~ s/.*:://;
# spent 7µs making 2 calls to Exporter::CORE:subst, avg 4µs/call
21211µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 1.61ms (14µs+1.60) within Exporter::export which was called 2 times, avg 807µs/call: # 2 times (14µs+1.60ms) by Exporter::import at line 62, avg 807µs/call
sub export {
25227µs41.77ms goto &{as_heavy()};
# spent 1.60ms making 2 calls to Exporter::as_heavy, avg 800µs/call # spent 167µs making 2 calls to Exporter::Heavy::heavy_export, avg 84µs/call
26}
27
28
# spent 3.58ms (1.60+1.98) within Exporter::import which was called 18 times, avg 199µs/call: # once (411µs+1.81ms) by OpenBSD::PackageInfo::BEGIN@39 at line 39 of OpenBSD/PackageInfo.pm # once (210µs+19µs) by OpenBSD::PackageRepository::Installed::BEGIN@197 at line 198 of OpenBSD/PackageRepository/Installed.pm # once (127µs+13µs) by OpenBSD::PackageLocation::BEGIN@23 at line 23 of OpenBSD/PackageLocation.pm # once (116µs+13µs) by OpenBSD::PkgInfo::BEGIN@177 at line 177 of OpenBSD/PkgInfo.pm # once (114µs+12µs) by OpenBSD::PkgInfo::State::BEGIN@65 at line 65 of OpenBSD/PkgInfo.pm # once (24µs+65µs) by OpenBSD::Getopt::getopts at line 85 of OpenBSD/Getopt.pm # once (77µs+3µs) by OpenBSD::State::BEGIN@86 at line 86 of OpenBSD/State.pm # once (69µs+5µs) by OpenBSD::PackageRepository::Local::BEGIN@454 at line 454 of OpenBSD/PackageRepository.pm # once (62µs+5µs) by OpenBSD::State::BEGIN@88 at line 88 of OpenBSD/State.pm # once (60µs+6µs) by OpenBSD::PackageRepository::BEGIN@32 at line 32 of OpenBSD/PackageRepository.pm # once (60µs+5µs) by OpenBSD::PackageLocation::BEGIN@25 at line 25 of OpenBSD/PackageLocation.pm # once (60µs+5µs) by OpenBSD::Temp::BEGIN@25 at line 25 of OpenBSD/Temp.pm # once (58µs+5µs) by OpenBSD::PkgInfo::BEGIN@180 at line 180 of OpenBSD/PkgInfo.pm # once (44µs+3µs) by OpenBSD::Error::BEGIN@72 at line 72 of OpenBSD/Error.pm # once (38µs+2µs) by OpenBSD::Temp::BEGIN@23 at line 23 of OpenBSD/Temp.pm # once (34µs+2µs) by OpenBSD::PkgInfo::BEGIN@179 at line 179 of OpenBSD/PkgInfo.pm # once (24µs+0s) by main::BEGIN@22 at line 22 of OpenBSD/PkgInfo.pm # once (10µs+0s) by OpenBSD::MkTemp::BEGIN@7 at line 7 of OpenBSD/MkTemp.pm
sub import {
291817µs my $pkg = shift;
301819µs my $callpkg = caller($ExportLevel);
31
321817µs if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
3313µs *{$callpkg."::import"} = \&import;
3414µs return;
35 }
36
37 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
381740µ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.
411727µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
421714µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
441720µs my $export_cache = ($Cache{$pkg} ||= {});
451751µs my $args = @_ or @_ = @$exports;
46
471713µs if ($args and not %$export_cache) {
48 s/^&//, $export_cache->{$_} = 1
492618µs172107µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 107µs making 172 calls to Exporter::CORE:subst, avg 624ns/call
50 }
511711µ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.
541724µ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
57467µs1215µs foreach (@_);
# spent 15µs making 12 calls to Exporter::CORE:match, avg 1µs/call
58 } else {
59 ($heavy = /\W/) and last
6013334µs10075µs foreach (@_);
# spent 75µs making 100 calls to Exporter::CORE:match, avg 747ns/call
61 }
621724µs21.61ms return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 1.61ms making 2 calls to Exporter::export, avg 807µs/call
63 local $SIG{__WARN__} =
641586µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
65 # shortcut for the common case of no type character
6615436µs *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
67}
68
69# Default methods
70
71sub 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
80sub export_to_level {
81 goto &{as_heavy()};
82}
83
84sub export_tags {
85 goto &{as_heavy()};
86}
87
88sub export_ok_tags {
89 goto &{as_heavy()};
90}
91
92sub require_version {
93 goto &{as_heavy()};
94}
95
9615µs1;
97__END__
 
# spent 90µs within Exporter::CORE:match which was called 112 times, avg 799ns/call: # 100 times (75µs+0s) by Exporter::import at line 60, avg 747ns/call # 12 times (15µs+0s) by Exporter::import at line 57, avg 1µs/call
sub Exporter::CORE:match; # opcode
# spent 115µs within Exporter::CORE:subst which was called 174 times, avg 659ns/call: # 172 times (107µs+0s) by Exporter::import at line 49, avg 624ns/call # 2 times (7µs+0s) by Exporter::as_heavy at line 20, avg 4µs/call
sub Exporter::CORE:subst; # opcode