Filename | /home/lbr/.plenv/versions/5.20.2/lib/perl5/5.20.2/strict.pm |
Statements | Executed 249 statements in 310µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
18 | 2 | 1 | 122µs | 122µs | bits | strict::
11 | 11 | 11 | 45µs | 134µs | import | strict::
1 | 1 | 1 | 36µs | 36µs | CORE:regcomp (opcode) | strict::
7 | 7 | 3 | 29µs | 63µs | unimport | strict::
1 | 1 | 1 | 9µs | 9µs | CORE:match (opcode) | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | 1 | 500ns | $strict::VERSION = "1.08"; | ||
4 | |||||
5 | # Verify that we're called correctly so that strictures will work. | ||||
6 | 1 | 69µs | 2 | 46µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 36µs making 1 call to strict::CORE:regcomp
# spent 9µ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 | 2µs | my %bitmask = ( | ||
13 | refs => 0x00000002, | ||||
14 | subs => 0x00000200, | ||||
15 | vars => 0x00000400 | ||||
16 | ); | ||||
17 | 1 | 1µs | my %explicit_bitmask = ( | ||
18 | refs => 0x00000020, | ||||
19 | subs => 0x00000040, | ||||
20 | vars => 0x00000080 | ||||
21 | ); | ||||
22 | |||||
23 | sub bits { | ||||
24 | 18 | 16µs | my $bits = 0; | ||
25 | 18 | 3µs | my @wrong; | ||
26 | 18 | 14µs | foreach my $s (@_) { | ||
27 | 39 | 16µs | if (exists $bitmask{$s}) { | ||
28 | 39 | 25µs | $^H |= $explicit_bitmask{$s}; | ||
29 | } | ||||
30 | else { push @wrong, $s }; | ||||
31 | 39 | 26µs | $bits |= $bitmask{$s} || 0; | ||
32 | } | ||||
33 | 18 | 5µs | if (@wrong) { | ||
34 | require Carp; | ||||
35 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
36 | } | ||||
37 | 18 | 47µs | $bits; | ||
38 | } | ||||
39 | |||||
40 | 1 | 1µs | my @default_bits = qw(refs subs vars); | ||
41 | |||||
42 | # spent 134µs (45+89) within strict::import which was called 11 times, avg 12µs/call:
# once (6µs+19µs) by Config::BEGIN@9 at line 9 of Config.pm
# once (6µs+12µs) by Encode::Config::BEGIN@7 at line 7 of Encode/Config.pm
# once (5µs+8µs) by Encode::Encoding::BEGIN@4 at line 4 of Encode/Encoding.pm
# once (4µs+7µs) by PerlIO::encoding::BEGIN@3 at line 3 of PerlIO/encoding.pm
# once (4µs+7µs) by Encode::Alias::BEGIN@2 at line 2 of Encode/Alias.pm
# once (4µs+6µs) by Encode::BEGIN@5 at line 5 of Encode.pm
# once (4µs+6µs) by vars::BEGIN@8 at line 8 of vars.pm
# once (3µs+6µs) by lib::BEGIN@8 at line 8 of lib.pm
# once (3µs+6µs) by Petal::Tiny::BEGIN@4 at line 4 of lib/Petal/Tiny.pm
# once (3µs+6µs) by constant::BEGIN@3 at line 3 of constant.pm
# once (3µs+6µs) by Carp::BEGIN@4 at line 4 of Carp.pm | ||||
43 | 11 | 2µs | shift; | ||
44 | 11 | 43µs | 11 | 89µs | $^H |= bits(@_ ? @_ : @default_bits); # spent 89µs making 11 calls to strict::bits, avg 8µs/call |
45 | } | ||||
46 | |||||
47 | # spent 63µs (29+33) within strict::unimport which was called 7 times, avg 9µs/call:
# once (6µs+5µs) by constant::BEGIN@39 at line 39 of constant.pm
# once (5µs+6µs) by Carp::BEGIN@555 at line 555 of Carp.pm
# once (5µs+5µs) by Config::BEGIN@47 at line 47 of Config.pm
# once (4µs+5µs) by Carp::BEGIN@131 at line 131 of Carp.pm
# once (4µs+4µs) by constant::BEGIN@126 at line 126 of constant.pm
# once (4µs+4µs) by constant::BEGIN@64 at line 64 of constant.pm
# once (3µs+4µs) by Carp::BEGIN@575 at line 575 of Carp.pm | ||||
48 | 7 | 2µs | shift; | ||
49 | 7 | 24µs | 7 | 33µs | $^H &= ~ bits(@_ ? @_ : @default_bits); # spent 33µs making 7 calls to strict::bits, avg 5µs/call |
50 | } | ||||
51 | |||||
52 | 1 | 12µs | 1; | ||
53 | __END__ | ||||
# spent 9µs within strict::CORE:match which was called:
# once (9µs+0s) by Config::BEGIN@9 at line 6 | |||||
# spent 36µs within strict::CORE:regcomp which was called:
# once (36µs+0s) by Config::BEGIN@9 at line 6 |