| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/aliased.pm |
| Statements | Executed 104 statements in 3.17ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 5 | 1 | 1 | 931µs | 354ms | aliased::_load_alias (recurses: max depth 1, inclusive time 2.13ms) |
| 5 | 1 | 1 | 338µs | 502µs | aliased::_make_alias |
| 5 | 5 | 2 | 202µs | 355ms | aliased::import (recurses: max depth 1, inclusive time 2.39ms) |
| 5 | 1 | 1 | 98µs | 164µs | aliased::_get_alias |
| 5 | 1 | 1 | 67µs | 67µs | aliased::CORE:subst (opcode) |
| 1 | 1 | 1 | 56µs | 72µs | aliased::BEGIN@8 |
| 1 | 1 | 1 | 30µs | 86µs | aliased::BEGIN@35 |
| 0 | 0 | 0 | 0s | 0s | aliased::__ANON__[:36] |
| 0 | 0 | 0 | 0s | 0s | aliased::alias |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package aliased; | ||||
| 2 | 1 | 2µs | $VERSION = '0.30'; | ||
| 3 | |||||
| 4 | 1 | 2µs | require Exporter; | ||
| 5 | 1 | 26µs | @ISA = qw(Exporter); | ||
| 6 | 1 | 3µs | @EXPORT = qw(alias); | ||
| 7 | |||||
| 8 | 2 | 696µs | 2 | 89µs | # spent 72µs (56+16) within aliased::BEGIN@8 which was called:
# once (56µs+16µs) by Data::DPath::Path::BEGIN@14 at line 8 # spent 72µs making 1 call to aliased::BEGIN@8
# spent 16µs making 1 call to strict::import |
| 9 | |||||
| 10 | # spent 355ms (202µs+355) within aliased::import which was called 5 times, avg 70.9ms/call:
# once (39µs+339ms) by Data::DPath::Path::BEGIN@16 at line 16 of Data/DPath/Path.pm
# once (47µs+13.3ms) by Data::DPath::Path::BEGIN@14 at line 14 of Data/DPath/Path.pm
# once (36µs+2.42ms) by Data::DPath::Path::BEGIN@15 at line 15 of Data/DPath/Path.pm
# once (49µs+-49µs) by Data::DPath::Context::BEGIN@14 at line 14 of Data/DPath/Context.pm
# once (31µs+-31µs) by Data::DPath::Context::BEGIN@15 at line 15 of Data/DPath/Context.pm | ||||
| 11 | 5 | 24µs | my ( $class, $package, $alias, @import ) = @_; | ||
| 12 | |||||
| 13 | 5 | 11µs | if ( @_ <= 1 ) { | ||
| 14 | $class->export_to_level(1); | ||||
| 15 | return; | ||||
| 16 | } | ||||
| 17 | |||||
| 18 | 5 | 11µs | my $callpack = caller(0); | ||
| 19 | |||||
| 20 | 5 | 36µs | 5 | 354ms | _load_alias( $package, $callpack, @import ); # spent 356ms making 5 calls to aliased::_load_alias, avg 71.3ms/call, recursion: max depth 1, sum of overlapping time 2.13ms |
| 21 | 5 | 112µs | 5 | 502µs | _make_alias( $package, $callpack, $alias ); # spent 502µs making 5 calls to aliased::_make_alias, avg 100µs/call |
| 22 | } | ||||
| 23 | |||||
| 24 | # spent 164µs (98+67) within aliased::_get_alias which was called 5 times, avg 33µs/call:
# 5 times (98µs+67µs) by aliased::_make_alias at line 33, avg 33µs/call | ||||
| 25 | 5 | 10µs | my $package = shift; | ||
| 26 | 5 | 112µs | 5 | 67µs | $package =~ s/.*(?:::|')//; # spent 67µs making 5 calls to aliased::CORE:subst, avg 13µs/call |
| 27 | 5 | 60µs | return $package; | ||
| 28 | } | ||||
| 29 | |||||
| 30 | # spent 502µs (338+164) within aliased::_make_alias which was called 5 times, avg 100µs/call:
# 5 times (338µs+164µs) by aliased::import at line 21, avg 100µs/call | ||||
| 31 | 5 | 23µs | my ( $package, $callpack, $alias ) = @_; | ||
| 32 | |||||
| 33 | 5 | 37µs | 5 | 164µs | $alias ||= _get_alias($package); # spent 164µs making 5 calls to aliased::_get_alias, avg 33µs/call |
| 34 | |||||
| 35 | 2 | 815µs | 2 | 143µs | # spent 86µs (30+56) within aliased::BEGIN@35 which was called:
# once (30µs+56µs) by Data::DPath::Path::BEGIN@14 at line 35 # spent 86µs making 1 call to aliased::BEGIN@35
# spent 56µs making 1 call to strict::unimport |
| 36 | 5 | 265µs | *{ join q{::} => $callpack, $alias } = sub () { $package }; | ||
| 37 | } | ||||
| 38 | |||||
| 39 | # spent 354ms (931µs+353) within aliased::_load_alias which was called 5 times, avg 70.9ms/call:
# 5 times (931µs+353ms) by aliased::import at line 20, avg 70.9ms/call | ||||
| 40 | 5 | 16µs | my ( $package, $callpack, @import ) = @_; | ||
| 41 | |||||
| 42 | # We don't localize $SIG{__DIE__} here because we need to be careful about | ||||
| 43 | # restoring its value if there is a failure. Very, very tricky. | ||||
| 44 | 5 | 11µs | my $sigdie = $SIG{__DIE__}; | ||
| 45 | { | ||||
| 46 | 10 | 40µs | my $code = | ||
| 47 | @import == 0 | ||||
| 48 | ? "package $callpack; use $package;" | ||||
| 49 | : "package $callpack; use $package (\@import)"; | ||||
| 50 | 5 | 732µs | eval $code; # spent 442µs executing statements in string eval # includes 12.8ms spent executing 1 call to 1 sub defined therein. # spent 436µs executing statements in string eval # includes 1.06ms spent executing 1 call to 1 sub defined therein. # spent 399µs executing statements in string eval # includes 962µs spent executing 1 call to 1 sub defined therein. # spent 368µs executing statements in string eval # includes 869µs spent executing 1 call to 1 sub defined therein. # spent 46µs executing statements in string eval # includes 39µs spent executing 1 call to 1 sub defined therein. | ||
| 51 | 5 | 11µs | if ( my $error = $@ ) { | ||
| 52 | $SIG{__DIE__} = $sigdie; | ||||
| 53 | die $error; | ||||
| 54 | } | ||||
| 55 | 5 | 26µs | $sigdie = $SIG{__DIE__} | ||
| 56 | if defined $SIG{__DIE__}; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | # Make sure a global $SIG{__DIE__} makes it out of the localization. | ||||
| 60 | 5 | 65µs | $SIG{__DIE__} = $sigdie if defined $sigdie; | ||
| 61 | } | ||||
| 62 | |||||
| 63 | sub alias { | ||||
| 64 | my ( $package, @import ) = @_; | ||||
| 65 | |||||
| 66 | my $callpack = scalar caller(0); | ||||
| 67 | _load_alias( $package, $callpack, @import ); | ||||
| 68 | |||||
| 69 | return $package; | ||||
| 70 | } | ||||
| 71 | |||||
| 72 | 1 | 18µs | 1; | ||
| 73 | __END__ | ||||
# spent 67µs within aliased::CORE:subst which was called 5 times, avg 13µs/call:
# 5 times (67µs+0s) by aliased::_get_alias at line 26, avg 13µs/call |