| Filename | /usr/share/perl5/Context/Preserve.pm |
| Statements | Executed 30021 statements in 62.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 3001 | 1 | 1 | 77.5ms | 962ms | Context::Preserve::preserve_context |
| 1 | 1 | 1 | 18µs | 24µs | Context::Preserve::BEGIN@2 |
| 1 | 1 | 1 | 10µs | 42µs | Context::Preserve::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 38µs | Context::Preserve::BEGIN@6 |
| 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 | 36µs | 2 | 30µs | # spent 24µs (18+6) within Context::Preserve::BEGIN@2 which was called:
# once (18µs+6µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 2 # spent 24µ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 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 | 62µs | 2 | 74µs | # spent 42µs (10+32) within Context::Preserve::BEGIN@4 which was called:
# once (10µs+32µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 4 # spent 42µs making 1 call to Context::Preserve::BEGIN@4
# spent 32µs making 1 call to Exporter::import |
| 5 | |||||
| 6 | 2 | 244µs | 2 | 38µs | # spent 38µs (8+30) within Context::Preserve::BEGIN@6 which was called:
# once (8µs+30µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 6 # spent 38µ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 | 1µs | our @EXPORT = qw(preserve_context); | ||
| 8 | |||||
| 9 | 1 | 100ns | our $VERSION = '0.01'; | ||
| 10 | |||||
| 11 | # spent 962ms (77.5+885) within Context::Preserve::preserve_context which was called 3001 times, avg 321µs/call:
# 3001 times (77.5ms+885ms) by DBIx::Class::Storage::BlockRunner::_run at line 233 of DBIx/Class/Storage/BlockRunner.pm, avg 321µs/call | ||||
| 12 | 3001 | 1.14ms | my $orig = shift; | ||
| 13 | 3001 | 4.29ms | my %args = @_; | ||
| 14 | |||||
| 15 | 3001 | 1.77ms | my $replace = $args{replace}; | ||
| 16 | 3001 | 1.69ms | my $after = $args{after}; | ||
| 17 | |||||
| 18 | 3001 | 1.61ms | croak 'need an "after" or "replace" coderef' | ||
| 19 | unless $replace || $after; | ||||
| 20 | |||||
| 21 | 3001 | 2.57ms | if(!defined wantarray){ | ||
| 22 | 1 | 7µs | 1 | 448µs | $orig->(); # spent 448µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155] |
| 23 | 1 | 800ns | if($after){ | ||
| 24 | $after->(); | ||||
| 25 | } | ||||
| 26 | else { | ||||
| 27 | 1 | 2µs | 1 | 24µs | $replace->(); # spent 24µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233] |
| 28 | } | ||||
| 29 | 1 | 5µs | return; | ||
| 30 | } | ||||
| 31 | elsif(wantarray){ | ||||
| 32 | 3000 | 21.9ms | 3000 | 833ms | my @result = $orig->(); # spent 833ms making 3000 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155], avg 278µs/call |
| 33 | 3000 | 2.50ms | if($after){ | ||
| 34 | my @ignored = $after->(@result); | ||||
| 35 | } | ||||
| 36 | else { | ||||
| 37 | 3000 | 8.50ms | 3000 | 51.0ms | @result = $replace->(@result); # spent 51.0ms making 3000 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233], avg 17µs/call |
| 38 | } | ||||
| 39 | 3000 | 15.9ms | 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 | 3µs | 1; | ||
| 54 | __END__ |