Filename | /usr/share/perl5/Context/Preserve.pm |
Statements | Executed 901 statements in 1.62ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
89 | 1 | 1 | 7.37ms | 29.6ms | preserve_context | Context::Preserve::
1 | 1 | 1 | 15µs | 22µs | BEGIN@2 | Context::Preserve::
1 | 1 | 1 | 0s | 0s | BEGIN@3 | Context::Preserve::
1 | 1 | 1 | 0s | 0s | BEGIN@4 | Context::Preserve::
1 | 1 | 1 | 0s | 0s | BEGIN@6 | Context::Preserve::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Context::Preserve; | ||||
2 | 2 | 13µs | 2 | 29µs | # spent 22µs (15+7) within Context::Preserve::BEGIN@2 which was called:
# once (15µs+7µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 2 # spent 22µs making 1 call to Context::Preserve::BEGIN@2
# spent 7µs making 1 call to strict::import |
3 | 2 | 100ns | 2 | 0s | # spent 0s within Context::Preserve::BEGIN@3 which was called:
# once (0s+0s) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 3 # spent 0s making 1 call to Context::Preserve::BEGIN@3
# spent 0s making 1 call to warnings::import |
4 | 2 | 200ns | 2 | 0s | # spent 0s within Context::Preserve::BEGIN@4 which was called:
# once (0s+0s) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 4 # spent 0s making 1 call to Context::Preserve::BEGIN@4
# spent 0s making 1 call to Exporter::import |
5 | |||||
6 | 2 | 52µs | 2 | 0s | # spent 0s within Context::Preserve::BEGIN@6 which was called:
# once (0s+0s) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 6 # spent 0s making 1 call to Context::Preserve::BEGIN@6
# spent 0s making 1 call to base::import, recursion: max depth 2, sum of overlapping time 0s |
7 | 1 | 1µs | our @EXPORT = qw(preserve_context); | ||
8 | |||||
9 | 1 | 200ns | our $VERSION = '0.01'; | ||
10 | |||||
11 | # spent 29.6ms (7.37+22.2) within Context::Preserve::preserve_context which was called 89 times, avg 332µs/call:
# 89 times (7.37ms+22.2ms) by DBIx::Class::Storage::BlockRunner::_run at line 233 of DBIx/Class/Storage/BlockRunner.pm, avg 332µs/call | ||||
12 | 89 | 28µs | my $orig = shift; | ||
13 | 89 | 119µs | my %args = @_; | ||
14 | |||||
15 | 89 | 60µs | my $replace = $args{replace}; | ||
16 | 89 | 59µs | my $after = $args{after}; | ||
17 | |||||
18 | 89 | 26µs | croak 'need an "after" or "replace" coderef' | ||
19 | unless $replace || $after; | ||||
20 | |||||
21 | 89 | 71µs | if(!defined wantarray){ | ||
22 | 1 | 7µs | 1 | 430µs | $orig->(); # spent 430µ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 | 23µs | $replace->(); # spent 23µ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 | 88 | 556µs | 88 | 20.5ms | my @result = $orig->(); # spent 20.5ms making 88 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155], avg 233µs/call |
33 | 88 | 63µs | if($after){ | ||
34 | my @ignored = $after->(@result); | ||||
35 | } | ||||
36 | else { | ||||
37 | 88 | 240µs | 88 | 1.26ms | @result = $replace->(@result); # spent 1.26ms making 88 calls to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233], avg 14µs/call |
38 | } | ||||
39 | 88 | 315µ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__ |