| Filename | /usr/share/perl5/Context/Preserve.pm |
| Statements | Executed 51 statements in 445µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 4 | 1 | 1 | 78µs | 1.57ms | Context::Preserve::preserve_context |
| 1 | 1 | 1 | 15µs | 22µs | Context::Preserve::BEGIN@2 |
| 1 | 1 | 1 | 9µs | 44µs | Context::Preserve::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 39µs | Context::Preserve::BEGIN@6 |
| 1 | 1 | 1 | 7µs | 11µs | Context::Preserve::BEGIN@3 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Context::Preserve; | ||||
| 2 | 2 | 35µs | 2 | 28µs | # spent 22µs (15+6) within Context::Preserve::BEGIN@2 which was called:
# once (15µs+6µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 2 # spent 22µs making 1 call to Context::Preserve::BEGIN@2
# spent 6µs making 1 call to strict::import |
| 3 | 2 | 26µs | 2 | 14µs | # spent 11µs (7+4) within Context::Preserve::BEGIN@3 which was called:
# once (7µs+4µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 3 # spent 11µs making 1 call to Context::Preserve::BEGIN@3
# spent 4µs making 1 call to warnings::import |
| 4 | 2 | 63µs | 2 | 78µs | # spent 44µs (9+34) within Context::Preserve::BEGIN@4 which was called:
# once (9µs+34µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 4 # spent 44µs making 1 call to Context::Preserve::BEGIN@4
# spent 34µs making 1 call to Exporter::import |
| 5 | |||||
| 6 | 2 | 248µs | 2 | 39µs | # spent 39µs (8+31) within Context::Preserve::BEGIN@6 which was called:
# once (8µs+31µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 6 # spent 39µs making 1 call to Context::Preserve::BEGIN@6
# spent 30µs making 1 call to base::import, recursion: max depth 2, sum of overlapping time 30µs |
| 7 | 1 | 900ns | our @EXPORT = qw(preserve_context); | ||
| 8 | |||||
| 9 | 1 | 200ns | our $VERSION = '0.01'; | ||
| 10 | |||||
| 11 | # spent 1.57ms (78µs+1.49) within Context::Preserve::preserve_context which was called 4 times, avg 393µs/call:
# 4 times (78µs+1.49ms) by DBIx::Class::Storage::BlockRunner::_run at line 233 of DBIx/Class/Storage/BlockRunner.pm, avg 393µs/call | ||||
| 12 | 4 | 1µs | my $orig = shift; | ||
| 13 | 4 | 6µs | my %args = @_; | ||
| 14 | |||||
| 15 | 4 | 2µs | my $replace = $args{replace}; | ||
| 16 | 4 | 2µs | my $after = $args{after}; | ||
| 17 | |||||
| 18 | 4 | 2µs | croak 'need an "after" or "replace" coderef' | ||
| 19 | unless $replace || $after; | ||||
| 20 | |||||
| 21 | 4 | 3µs | if(!defined wantarray){ | ||
| 22 | 1 | 6µs | 1 | 374µs | $orig->(); # spent 374µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155] |
| 23 | 1 | 600ns | if($after){ | ||
| 24 | $after->(); | ||||
| 25 | } | ||||
| 26 | else { | ||||
| 27 | 1 | 2µs | 1 | 22µs | $replace->(); # spent 22µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233] |
| 28 | } | ||||
| 29 | 1 | 4µs | return; | ||
| 30 | } | ||||
| 31 | elsif(wantarray){ | ||||
| 32 | 3 | 20µs | 3 | 1.05ms | my @result = $orig->(); # spent 1.05ms making 3 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155], avg 351µs/call |
| 33 | 3 | 2µs | if($after){ | ||
| 34 | my @ignored = $after->(@result); | ||||
| 35 | } | ||||
| 36 | else { | ||||
| 37 | 3 | 8µs | 3 | 42µs | @result = $replace->(@result); # spent 42µs making 3 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233], avg 14µs/call |
| 38 | } | ||||
| 39 | 3 | 10µs | return @result; | ||
| 40 | } | ||||
| 41 | else { | ||||
| 42 | my $result = $orig->(); | ||||
| 43 | if($after){ | ||||
| 44 | my $ignored = $after->($result); | ||||
| 45 | } | ||||
| 46 | else { | ||||
| 47 | $result = $replace->($result); | ||||
| 48 | } | ||||
| 49 | return $result; | ||||
| 50 | } | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | 1 | 4µs | 1; | ||
| 54 | __END__ |