| Filename | /usr/share/perl5/Context/Preserve.pm |
| Statements | Executed 850 statements in 1.63ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 318 | 1 | 1 | 12.0ms | 258ms | Context::Preserve::preserve_context |
| 1 | 1 | 1 | 134µs | 172µs | Context::Preserve::BEGIN@6 |
| 1 | 1 | 1 | 13µs | 20µs | Context::Preserve::BEGIN@2 |
| 1 | 1 | 1 | 10µs | 54µs | Context::Preserve::BEGIN@4 |
| 1 | 1 | 1 | 7µs | 10µs | Context::Preserve::BEGIN@3 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Context::Preserve; | ||||
| 2 | 2 | 26µs | # spent 20µs (13+6) within Context::Preserve::BEGIN@2 which was called:
# once (13µs+6µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 2 # spent 20µs making 1 call to Context::Preserve::BEGIN@2
# spent 6µs making 1 call to strict::import | ||
| 3 | 2 | 14µs | # spent 10µ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 10µs making 1 call to Context::Preserve::BEGIN@3
# spent 4µs making 1 call to warnings::import | ||
| 4 | 2 | 98µs | # spent 54µs (10+44) within Context::Preserve::BEGIN@4 which was called:
# once (10µs+44µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 4 # spent 54µs making 1 call to Context::Preserve::BEGIN@4
# spent 44µs making 1 call to Exporter::import | ||
| 5 | |||||
| 6 | 2 | 172µs | # spent 172µs (134+38) within Context::Preserve::BEGIN@6 which was called:
# once (134µs+38µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 6 # spent 172µs making 1 call to Context::Preserve::BEGIN@6
# spent 38µs making 1 call to base::import, recursion: max depth 2, sum of overlapping time 38µs | ||
| 7 | our @EXPORT = qw(preserve_context); | ||||
| 8 | |||||
| 9 | our $VERSION = '0.01'; | ||||
| 10 | |||||
| 11 | # spent 258ms (12.0+246) within Context::Preserve::preserve_context which was called 318 times, avg 811µs/call:
# 318 times (12.0ms+246ms) by DBIx::Class::Storage::BlockRunner::_run at line 233 of DBIx/Class/Storage/BlockRunner.pm, avg 811µs/call | ||||
| 12 | 85 | 29µs | my $orig = shift; | ||
| 13 | 85 | 114µs | my %args = @_; | ||
| 14 | |||||
| 15 | 85 | 57µs | my $replace = $args{replace}; | ||
| 16 | 85 | 46µs | my $after = $args{after}; | ||
| 17 | |||||
| 18 | 85 | 31µs | croak 'need an "after" or "replace" coderef' | ||
| 19 | unless $replace || $after; | ||||
| 20 | |||||
| 21 | 85 | 61µs | if(!defined wantarray){ | ||
| 22 | 1 | 433µs | $orig->(); # spent 433µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155] | ||
| 23 | if($after){ | ||||
| 24 | $after->(); | ||||
| 25 | } | ||||
| 26 | else { | ||||
| 27 | 1 | 24µs | $replace->(); # spent 24µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233] | ||
| 28 | } | ||||
| 29 | return; | ||||
| 30 | } | ||||
| 31 | elsif(wantarray){ | ||||
| 32 | 85 | 689µs | 317 | 240ms | my @result = $orig->(); # spent 240ms making 317 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155], avg 758µs/call |
| 33 | 85 | 60µs | if($after){ | ||
| 34 | my @ignored = $after->(@result); | ||||
| 35 | } | ||||
| 36 | else { | ||||
| 37 | 85 | 251µs | 317 | 5.21ms | @result = $replace->(@result); # spent 5.21ms making 317 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233], avg 16µs/call |
| 38 | } | ||||
| 39 | 85 | 294µ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; | ||||
| 54 | __END__ |