| Filename | /usr/share/perl/5.14/Exporter.pm | 
| Statements | Executed 327 statements in 632µs | 
| Calls | P | F | Exclusive Time | Inclusive Time | Subroutine | 
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.08ms | 1.11ms | Exporter::as_heavy | 
| 21 | 21 | 10 | 473µs | 1.65ms | Exporter::import | 
| 19 | 2 | 1 | 15µs | 15µs | Exporter::CORE:match (opcode) | 
| 11 | 2 | 1 | 9µs | 9µs | Exporter::CORE:subst (opcode) | 
| 1 | 1 | 1 | 4µs | 1.12ms | Exporter::export | 
| 0 | 0 | 0 | 0s | 0s | Exporter::__ANON__[:65] | 
| 0 | 0 | 0 | 0s | 0s | Exporter::export_fail | 
| 0 | 0 | 0 | 0s | 0s | Exporter::export_ok_tags | 
| 0 | 0 | 0 | 0s | 0s | Exporter::export_tags | 
| 0 | 0 | 0 | 0s | 0s | Exporter::export_to_level | 
| 0 | 0 | 0 | 0s | 0s | Exporter::require_version | 
| Line | State ments | Time on line | Calls | Time in subs | Code | 
|---|---|---|---|---|---|
| 1 | package Exporter; | ||||
| 2 | |||||
| 3 | 1 | 25µs | require 5.006; | ||
| 4 | |||||
| 5 | # Be lean. | ||||
| 6 | #use strict; | ||||
| 7 | #no strict 'refs'; | ||||
| 8 | |||||
| 9 | 1 | 400ns | our $Debug = 0; | ||
| 10 | 1 | 200ns | our $ExportLevel = 0; | ||
| 11 | 1 | 500ns | our $Verbose ||= 0; | ||
| 12 | 1 | 500ns | our $VERSION = '5.64_03'; | ||
| 13 | 1 | 300ns | our (%Cache); | ||
| 14 | |||||
| 15 | # spent 1.11ms (1.08+38µs) within Exporter::as_heavy which was called:
#    once (1.08ms+38µs) by Exporter::export at line 25 | ||||
| 16 | 4 | 71µ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 | my $c = (caller(1))[3]; | ||||
| 20 | 1 | 3µs | $c =~ s/.*:://;   # spent     3µs making 1 call to Exporter::CORE:subst | ||
| 21 | \&{"Exporter::Heavy::heavy_$c"}; | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | # spent 1.12ms (4µs+1.11) within Exporter::export which was called:
#    once (4µs+1.11ms) by Exporter::import at line 63 | ||||
| 25 | 1 | 5µs | 2 | 1.15ms | goto &{as_heavy()};   # spent  1.11ms making 1 call to Exporter::as_heavy
  # spent    41µs making 1 call to Exporter::Heavy::heavy_export | 
| 26 | } | ||||
| 27 | |||||
| 28 | # spent 1.65ms (473µs+1.18) within Exporter::import which was called 21 times, avg 79µs/call:
#    once (13µs+1.16ms) by Getopt::Long::import at line 113 of Getopt/Long.pm
#    once (140µs+6µs) by Function::Parameters::BEGIN@7 at line 7 of Function/Parameters.pm
#    once (35µs+2µs) by NewBoard::BEGIN@25 at line 25 of NewBoard.pm
#    once (32µs+2µs) by NewBoard::BEGIN@24 at line 24 of NewBoard.pm
#    once (29µs+1µs) by Tuple::BEGIN@5 at line 5 of /homes/dcw/lib/perl5/DCW/Tuple.pm
#    once (23µs+1µs) by Data::Dumper::BEGIN@20 at line 20 of Data/Dumper.pm
#    once (23µs+1µs) by Clone::BEGIN@5 at line 5 of Clone.pm
#    once (17µs+700ns) by main::BEGIN@9 at line 9 of testnewboardincnply
#    once (17µs+800ns) by NewBoard::BEGIN@19 at line 19 of NewBoard.pm
#    once (16µs+700ns) by main::BEGIN@15 at line 15 of NewIncNPlyPicker.pm
#    once (15µs+600ns) by main::BEGIN@18 at line 18 of NewIncNPlyPicker.pm
#    once (15µs+700ns) by main::BEGIN@7.9 at line 7 of NewSolveGame.pm
#    once (14µs+700ns) by main::BEGIN@10.11 at line 10 of NewSolveGame.pm
#    once (14µs+0s) by main::BEGIN@12 at line 12 of testnewboardincnply
#    once (13µs+600ns) by main::BEGIN@19 at line 19 of NewIncNPlyPicker.pm
#    once (13µs+0s) by Getopt::Long::BEGIN@25 at line 25 of Getopt/Long.pm
#    once (12µs+500ns) by main::BEGIN@11 at line 11 of NewSolveGame.pm
#    once (9µs+0s) by main::BEGIN@22 at line 22 of NewIncNPlyPicker.pm
#    once (9µs+0s) by main::BEGIN@14.13 at line 14 of NewSolveGame.pm
#    once (6µs+0s) by List::BEGIN@15 at line 15 of /homes/dcw/lib/perl5/DCW/List.pm
#    once (6µs+0s) by Tuple::BEGIN@13 at line 13 of /homes/dcw/lib/perl5/DCW/Tuple.pm | ||||
| 29 | 289 | 371µs | my $pkg = shift; | ||
| 30 | my $callpkg = caller($ExportLevel); | ||||
| 31 | |||||
| 32 | 4 | 14µ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 | 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 | my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; | ||||
| 42 | return export $pkg, $callpkg, @_ | ||||
| 43 | if $Verbose or $Debug or $fail && @$fail > 1; | ||||
| 44 | my $export_cache = ($Cache{$pkg} ||= {}); | ||||
| 45 | my $args = @_ or @_ = @$exports; | ||||
| 46 | |||||
| 47 | local $_; | ||||
| 48 | 3 | 58µs | if ($args and not %$export_cache) { | ||
| 49 | s/^&//, $export_cache->{$_} = 1 | ||||
| 50 | 10 | 6µs | foreach (@$exports, @{"$pkg\::EXPORT_OK"});       # spent     6µs making 10 calls to Exporter::CORE:subst, avg 600ns/call | ||
| 51 | } | ||||
| 52 | my $heavy; | ||||
| 53 | # Try very hard not to use {} and hence have to enter scope on the foreach | ||||
| 54 | # We bomb out of the loop with last as soon as heavy is set. | ||||
| 55 | 19 | 77µs | if ($args or $fail) { | ||
| 56 | ($heavy = (/\W/ or $args and not exists $export_cache->{$_} | ||||
| 57 | or $fail and @$fail and $_ eq $fail->[0])) and last | ||||
| 58 | 13 | 9µs | foreach (@_);                  # spent     9µs making 13 calls to Exporter::CORE:match, avg 708ns/call | ||
| 59 | } else { | ||||
| 60 | ($heavy = /\W/) and last | ||||
| 61 | 6 | 5µs | foreach (@_);       # spent     5µs making 6 calls to Exporter::CORE:match, avg 900ns/call | ||
| 62 | } | ||||
| 63 | 1 | 1.12ms | return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;   # spent  1.12ms making 1 call to Exporter::export | ||
| 64 | local $SIG{__WARN__} = | ||||
| 65 | sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; | ||||
| 66 | # shortcut for the common case of no type character | ||||
| 67 | *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | # Default methods | ||||
| 71 | |||||
| 72 | sub export_fail { | ||||
| 73 | my $self = shift; | ||||
| 74 | @_; | ||||
| 75 | } | ||||
| 76 | |||||
| 77 | # Unfortunately, caller(1)[3] "does not work" if the caller is aliased as | ||||
| 78 | # *name = \&foo. Thus the need to create a lot of identical subroutines | ||||
| 79 | # Otherwise we could have aliased them to export(). | ||||
| 80 | |||||
| 81 | sub export_to_level { | ||||
| 82 | goto &{as_heavy()}; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | sub export_tags { | ||||
| 86 | goto &{as_heavy()}; | ||||
| 87 | } | ||||
| 88 | |||||
| 89 | sub export_ok_tags { | ||||
| 90 | goto &{as_heavy()}; | ||||
| 91 | } | ||||
| 92 | |||||
| 93 | sub require_version { | ||||
| 94 | goto &{as_heavy()}; | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | 1 | 8µs | 1; | ||
| 98 | __END__ | ||||
| sub Exporter::CORE:match; # opcode | |||||
| sub Exporter::CORE:subst; # opcode |