| Filename | /System/Library/Perl/5.12/strict.pm |
| Statements | Executed 27 statements in 212µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 45µs | 45µs | strict::CORE:regcomp (opcode) |
| 2 | 2 | 1 | 33µs | 33µs | strict::bits |
| 1 | 1 | 1 | 18µs | 18µs | strict::CORE:match (opcode) |
| 1 | 1 | 1 | 18µs | 28µs | strict::unimport |
| 1 | 1 | 1 | 7µs | 7µs | strict::import |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package strict; | ||||
| 2 | |||||
| 3 | 1 | 2µs | $strict::VERSION = "1.04"; | ||
| 4 | |||||
| 5 | # Verify that we're called correctly so that strictures will work. | ||||
| 6 | 1 | 92µs | 2 | 63µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 45µs making 1 call to strict::CORE:regcomp
# spent 18µs making 1 call to strict::CORE:match |
| 7 | # Can't use Carp, since Carp uses us! | ||||
| 8 | my (undef, $f, $l) = caller; | ||||
| 9 | die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n"); | ||||
| 10 | } | ||||
| 11 | |||||
| 12 | 1 | 4µs | my %bitmask = ( | ||
| 13 | refs => 0x00000002, | ||||
| 14 | subs => 0x00000200, | ||||
| 15 | vars => 0x00000400 | ||||
| 16 | ); | ||||
| 17 | |||||
| 18 | sub bits { | ||||
| 19 | 10 | 27µs | my $bits = 0; | ||
| 20 | my @wrong; | ||||
| 21 | foreach my $s (@_) { | ||||
| 22 | 8 | 12µs | push @wrong, $s unless exists $bitmask{$s}; | ||
| 23 | $bits |= $bitmask{$s} || 0; | ||||
| 24 | } | ||||
| 25 | if (@wrong) { | ||||
| 26 | require Carp; | ||||
| 27 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
| 28 | } | ||||
| 29 | $bits; | ||||
| 30 | } | ||||
| 31 | |||||
| 32 | 1 | 4µs | 1 | 23µs | my $default_bits = bits(qw(refs subs vars)); # spent 23µs making 1 call to strict::bits |
| 33 | |||||
| 34 | # spent 7µs within strict::import which was called:
# once (7µs+0s) by Parse::Lexer::BEGIN@4 at line 4 of Parse/Lexer.pm | ||||
| 35 | 2 | 11µs | shift; | ||
| 36 | $^H |= @_ ? bits(@_) : $default_bits; | ||||
| 37 | } | ||||
| 38 | |||||
| 39 | # spent 28µs (18+10) within strict::unimport which was called:
# once (18µs+10µs) by Carp::BEGIN@303 at line 303 of Carp.pm | ||||
| 40 | 2 | 15µs | shift; | ||
| 41 | 1 | 10µs | $^H &= ~ (@_ ? bits(@_) : $default_bits); # spent 10µs making 1 call to strict::bits | ||
| 42 | } | ||||
| 43 | |||||
| 44 | 1 | 45µs | 1; | ||
| 45 | __END__ | ||||
# spent 18µs within strict::CORE:match which was called:
# once (18µs+0s) by Parse::Lexer::BEGIN@4 at line 6 | |||||
# spent 45µs within strict::CORE:regcomp which was called:
# once (45µs+0s) by Parse::Lexer::BEGIN@4 at line 6 |