Filename | /usr/share/perl/5.20/if.pm |
Statements | Executed 35 statements in 746µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 1.09ms | 1.14ms | work | if::
3 | 3 | 3 | 11µs | 11µs | import | if::
3 | 1 | 1 | 4µs | 4µs | CORE:subst (opcode) | if::
0 | 0 | 0 | 0s | 0s | unimport | if::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package if; | ||||
2 | |||||
3 | 1 | 400ns | $VERSION = '0.0603'; | ||
4 | |||||
5 | # spent 1.14ms (1.09+52µs) within if::work which was called 3 times, avg 381µs/call:
# 3 times (1.09ms+52µs) by CGI::BEGIN@3 or CGI::Cookie::BEGIN@6 or CGI::Util::BEGIN@5 at line 18, avg 381µs/call | ||||
6 | 3 | 2µs | my $method = shift() ? 'import' : 'unimport'; | ||
7 | 3 | 2µs | die "Too few arguments to 'use if' (some code returning an empty list in list context?)" | ||
8 | unless @_ >= 2; | ||||
9 | 3 | 800ns | return unless shift; # CONDITION | ||
10 | |||||
11 | 3 | 1µs | my $p = $_[0]; # PACKAGE | ||
12 | 3 | 16µs | 3 | 4µs | (my $file = "$p.pm") =~ s!::!/!g; # spent 4µs making 3 calls to if::CORE:subst, avg 2µs/call |
13 | 3 | 658µs | require $file; # Works even if $_[0] is a keyword (like open) | ||
14 | 3 | 26µs | 3 | 7µs | my $m = $p->can($method); # spent 7µs making 3 calls to UNIVERSAL::can, avg 2µs/call |
15 | 3 | 16µs | 3 | 236µs | goto &$m if $m; # spent 236µs making 3 calls to deprecate::import, avg 79µs/call |
16 | } | ||||
17 | |||||
18 | 9 | 22µs | 3 | 1.14ms | # spent 11µs within if::import which was called 3 times, avg 4µs/call:
# once (4µs+0s) by CGI::Util::BEGIN@5 at line 5 of CGI/Util.pm
# once (4µs+0s) by CGI::Cookie::BEGIN@6 at line 6 of CGI/Cookie.pm
# once (3µs+0s) by CGI::BEGIN@3 at line 3 of CGI.pm # spent 1.14ms making 3 calls to if::work, avg 381µs/call |
19 | sub unimport { shift; unshift @_, 0; goto &work } | ||||
20 | |||||
21 | 1 | 2µs | 1; | ||
22 | __END__ | ||||
# spent 4µs within if::CORE:subst which was called 3 times, avg 2µs/call:
# 3 times (4µs+0s) by if::work at line 12, avg 2µs/call |