| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/if.pm |
| Statements | Executed 24 statements in 357µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 181µs | 225µs | if::work |
| 2 | 2 | 1 | 37µs | 37µs | if::import |
| 2 | 1 | 1 | 20µs | 20µs | if::CORE:subst (opcode) |
| 0 | 0 | 0 | 0s | 0s | if::unimport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package if; | ||||
| 2 | |||||
| 3 | 1 | 4µs | $VERSION = '0.05'; | ||
| 4 | |||||
| 5 | # spent 225µs (181+44) within if::work which was called 2 times, avg 112µs/call:
# 2 times (181µs+44µs) by Moose::Object::BEGIN@13 or Moose::Object::BEGIN@14 at line 18, avg 112µs/call | ||||
| 6 | 16 | 272µs | my $method = shift() ? 'import' : 'unimport'; | ||
| 7 | die "Too few arguments to `use if' (some code returning an empty list in list context?)" | ||||
| 8 | unless @_ >= 2; | ||||
| 9 | return unless shift; # CONDITION | ||||
| 10 | |||||
| 11 | my $p = $_[0]; # PACKAGE | ||||
| 12 | 2 | 20µs | (my $file = "$p.pm") =~ s!::!/!g; # spent 20µs making 2 calls to if::CORE:subst, avg 10µs/call | ||
| 13 | require $file; # Works even if $_[0] is a keyword (like open) | ||||
| 14 | 2 | 23µs | my $m = $p->can($method); # spent 23µs making 2 calls to UNIVERSAL::can, avg 12µs/call | ||
| 15 | 1 | 14.7ms | goto &$m if $m; # spent 14.7ms making 1 call to metaclass::import | ||
| 16 | } | ||||
| 17 | |||||
| 18 | 6 | 71µs | 2 | 225µs | # spent 37µs within if::import which was called 2 times, avg 18µs/call:
# once (21µs+0s) by Moose::Object::BEGIN@13 at line 13 of Moose/Object.pm
# once (16µs+0s) by Moose::Object::BEGIN@14 at line 14 of Moose/Object.pm # spent 225µs making 2 calls to if::work, avg 112µs/call |
| 19 | sub unimport { shift; unshift @_, 0; goto &work } | ||||
| 20 | |||||
| 21 | 1 | 11µs | 1; | ||
| 22 | __END__ | ||||
# spent 20µs within if::CORE:subst which was called 2 times, avg 10µs/call:
# 2 times (20µs+0s) by if::work at line 12, avg 10µs/call |