← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:31:06 2016
Reported on Fri Jan 8 14:33:29 2016

Filename/usr/share/perl5/Context/Preserve.pm
StatementsExecuted 850 statements in 1.63ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3181112.0ms258msContext::Preserve::::preserve_contextContext::Preserve::preserve_context
111134µs172µsContext::Preserve::::BEGIN@6Context::Preserve::BEGIN@6
11113µs20µsContext::Preserve::::BEGIN@2Context::Preserve::BEGIN@2
11110µs54µsContext::Preserve::::BEGIN@4Context::Preserve::BEGIN@4
1117µs10µsContext::Preserve::::BEGIN@3Context::Preserve::BEGIN@3
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Context::Preserve;
2226µ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
use strict;
# spent 20µs making 1 call to Context::Preserve::BEGIN@2 # spent 6µs making 1 call to strict::import
3214µ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
use warnings;
# spent 10µs making 1 call to Context::Preserve::BEGIN@3 # spent 4µs making 1 call to warnings::import
4298µ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
use Carp;
# spent 54µs making 1 call to Context::Preserve::BEGIN@4 # spent 44µs making 1 call to Exporter::import
5
62172µ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
use base 'Exporter';
# 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
7our @EXPORT = qw(preserve_context);
8
9our $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
sub preserve_context(&@) {
128529µs my $orig = shift;
1385114µs my %args = @_;
14
158557µs my $replace = $args{replace};
168546µs my $after = $args{after};
17
188531µs croak 'need an "after" or "replace" coderef'
19 unless $replace || $after;
20
218561µs if(!defined wantarray){
221433µs $orig->();
23 if($after){
24 $after->();
25 }
26 else {
27124µs $replace->();
28 }
29 return;
30 }
31 elsif(wantarray){
3285689µs317240ms my @result = $orig->();
338560µs if($after){
34 my @ignored = $after->(@result);
35 }
36 else {
3785251µs3175.21ms @result = $replace->(@result);
38 }
3985294µ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
531;
54__END__