Filename | /usr/share/perl5/core_perl/strict.pm |
Statements | Executed 279 statements in 1.13ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
21 | 2 | 1 | 447µs | 447µs | bits | strict::
11 | 11 | 11 | 158µs | 432µs | import | strict::
10 | 10 | 4 | 152µs | 325µs | unimport | strict::
1 | 1 | 1 | 47µs | 47µs | CORE:regcomp (opcode) | strict::
1 | 1 | 1 | 11µs | 11µs | CORE:match (opcode) | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | 1 | 2µs | $strict::VERSION = "1.07"; | ||
4 | |||||
5 | # Verify that we're called correctly so that strictures will work. | ||||
6 | 1 | 90µs | 2 | 58µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 47µs making 1 call to strict::CORE:regcomp
# spent 11µ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 | 6µs | my %bitmask = ( | ||
13 | refs => 0x00000002, | ||||
14 | subs => 0x00000200, | ||||
15 | vars => 0x00000400 | ||||
16 | ); | ||||
17 | 1 | 3µs | my %explicit_bitmask = ( | ||
18 | refs => 0x00000020, | ||||
19 | subs => 0x00000040, | ||||
20 | vars => 0x00000080 | ||||
21 | ); | ||||
22 | |||||
23 | sub bits { | ||||
24 | 21 | 20µs | my $bits = 0; | ||
25 | 21 | 9µs | my @wrong; | ||
26 | 21 | 70µs | foreach my $s (@_) { | ||
27 | 42 | 54µs | if (exists $bitmask{$s}) { | ||
28 | 42 | 108µs | $^H |= $explicit_bitmask{$s}; | ||
29 | } | ||||
30 | else { push @wrong, $s }; | ||||
31 | 42 | 94µs | $bits |= $bitmask{$s} || 0; | ||
32 | } | ||||
33 | 21 | 20µs | if (@wrong) { | ||
34 | require Carp; | ||||
35 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
36 | } | ||||
37 | 21 | 205µs | $bits; | ||
38 | } | ||||
39 | |||||
40 | 1 | 3µs | my @default_bits = qw(refs subs vars); | ||
41 | |||||
42 | # spent 432µs (158+274) within strict::import which was called 11 times, avg 39µs/call:
# once (20µs+40µs) by Runner::BEGIN@9 at line 9 of runner.pl
# once (18µs+30µs) by attributes::BEGIN@9 at line 9 of attributes.pm
# once (17µs+30µs) by constant::BEGIN@3 at line 3 of constant.pm
# once (14µs+27µs) by Carp::BEGIN@4 at line 4 of Carp.pm
# once (15µs+24µs) by Runner::Job::BEGIN@3 at line 3 of Runner/Job.pm
# once (14µs+22µs) by List::Util::BEGIN@9 at line 9 of List/Util.pm
# once (13µs+20µs) by vars::BEGIN@8 at line 8 of vars.pm
# once (13µs+21µs) by Runner::IO::BEGIN@3 at line 3 of Runner/IO.pm
# once (12µs+20µs) by Runner::Stats::BEGIN@3 at line 3 of Runner/Stats.pm
# once (12µs+19µs) by Config::BEGIN@9 at line 9 of Config.pm
# once (11µs+19µs) by List::MoreUtils::BEGIN@4 at line 4 of List/MoreUtils.pm | ||||
43 | 11 | 6µs | shift; | ||
44 | 11 | 269µs | 11 | 274µs | $^H |= bits(@_ ? @_ : @default_bits); # spent 274µs making 11 calls to strict::bits, avg 25µs/call |
45 | } | ||||
46 | |||||
47 | # spent 325µs (152+173) within strict::unimport which was called 10 times, avg 33µs/call:
# once (18µs+21µs) by Carp::BEGIN@433 at line 433 of Carp.pm
# once (17µs+20µs) by constant::BEGIN@28 at line 28 of constant.pm
# once (16µs+20µs) by constant::BEGIN@116 at line 116 of constant.pm
# once (19µs+16µs) by Carp::BEGIN@8 at line 8 of Carp.pm
# once (15µs+18µs) by Carp::BEGIN@67 at line 67 of Carp.pm
# once (14µs+17µs) by constant::BEGIN@54 at line 54 of constant.pm
# once (14µs+16µs) by Carp::BEGIN@18 at line 18 of Carp.pm
# once (13µs+16µs) by Carp::BEGIN@448 at line 448 of Carp.pm
# once (14µs+14µs) by List::Util::BEGIN@30 at line 30 of List/Util.pm
# once (13µs+14µs) by Config::BEGIN@47 at line 47 of Config.pm | ||||
48 | 10 | 5µs | shift; | ||
49 | 10 | 138µs | 10 | 173µs | $^H &= ~ bits(@_ ? @_ : @default_bits); # spent 173µs making 10 calls to strict::bits, avg 17µs/call |
50 | } | ||||
51 | |||||
52 | 1 | 29µs | 1; | ||
53 | __END__ | ||||
# spent 11µs within strict::CORE:match which was called:
# once (11µs+0s) by Runner::BEGIN@9 at line 6 | |||||
# spent 47µs within strict::CORE:regcomp which was called:
# once (47µs+0s) by Runner::BEGIN@9 at line 6 |