Filename | /usr/share/perl/5.18/strict.pm |
Statements | Executed 437 statements in 531µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
32 | 2 | 1 | 224µs | 224µs | bits | strict::
18 | 18 | 17 | 88µs | 227µs | import | strict::
14 | 14 | 8 | 69µs | 153µs | unimport | strict::
1 | 1 | 1 | 29µs | 29µs | CORE:regcomp (opcode) | strict::
1 | 1 | 1 | 10µs | 10µs | CORE:match (opcode) | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | 1 | 1µs | $strict::VERSION = "1.07"; | ||
4 | |||||
5 | # Verify that we're called correctly so that strictures will work. | ||||
6 | 1 | 71µs | 2 | 38µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 29µs making 1 call to strict::CORE:regcomp
# spent 10µ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 | 3µ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 | 32 | 9µs | my $bits = 0; | ||
25 | 32 | 4µs | my @wrong; | ||
26 | 32 | 30µs | foreach my $s (@_) { | ||
27 | 69 | 31µs | if (exists $bitmask{$s}) { | ||
28 | 69 | 50µs | $^H |= $explicit_bitmask{$s}; | ||
29 | } | ||||
30 | else { push @wrong, $s }; | ||||
31 | 69 | 58µs | $bits |= $bitmask{$s} || 0; | ||
32 | } | ||||
33 | 32 | 8µs | if (@wrong) { | ||
34 | require Carp; | ||||
35 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
36 | } | ||||
37 | 32 | 110µs | $bits; | ||
38 | } | ||||
39 | |||||
40 | 1 | 1µs | my @default_bits = qw(refs subs vars); | ||
41 | |||||
42 | # spent 227µs (88+139) within strict::import which was called 18 times, avg 13µs/call:
# once (10µs+16µs) by main::BEGIN@1 at line 1 of examples/benchmark4.pl
# once (5µs+10µs) by NetAddr::IP::UtilPolluted::BEGIN@197 at line 197 of NetAddr/IP/Util.pm
# once (6µs+7µs) by Benchmark::BEGIN@3 at line 3 of Benchmark.pm
# once (5µs+8µs) by Socket6::BEGIN@38 at line 38 of Socket6.pm
# once (5µs+8µs) by NetAddr::IP::FastNew::BEGIN@3 at line 3 of lib/NetAddr/IP/FastNew.pm
# once (5µs+7µs) by NetAddr::IP::Util::BEGIN@4 at line 4 of NetAddr/IP/Util.pm
# once (5µs+7µs) by Socket::BEGIN@3 at line 3 of Socket.pm
# once (5µs+7µs) by Exporter::Heavy::BEGIN@3 at line 3 of Exporter/Heavy.pm
# once (4µs+8µs) by Config::BEGIN@9 at line 9 of Config.pm
# once (5µs+7µs) by AutoLoader::BEGIN@3 at line 3 of AutoLoader.pm
# once (4µs+8µs) by Time::HiRes::BEGIN@4 at line 4 of Time/HiRes.pm
# once (4µs+7µs) by lib::BEGIN@8 at line 8 of lib.pm
# once (4µs+7µs) by NetAddr::IP::BEGIN@5 at line 5 of NetAddr/IP.pm
# once (5µs+7µs) by NetAddr::IP::InetBase::BEGIN@4 at line 4 of NetAddr/IP/InetBase.pm
# once (5µs+6µs) by base::BEGIN@3 at line 3 of base.pm
# once (4µs+7µs) by NetAddr::IP::Lite::BEGIN@6 at line 6 of NetAddr/IP/Lite.pm
# once (4µs+6µs) by Carp::BEGIN@4 at line 4 of Carp.pm
# once (4µs+6µs) by vars::BEGIN@8 at line 8 of vars.pm | ||||
43 | 18 | 3µs | shift; | ||
44 | 18 | 75µs | 18 | 139µs | $^H |= bits(@_ ? @_ : @default_bits); # spent 139µs making 18 calls to strict::bits, avg 8µs/call |
45 | } | ||||
46 | |||||
47 | # spent 153µs (69+85) within strict::unimport which was called 14 times, avg 11µs/call:
# once (5µs+10µs) by AutoLoader::BEGIN@146 at line 146 of AutoLoader.pm
# once (5µs+9µs) by Carp::BEGIN@433 at line 433 of Carp.pm
# once (6µs+6µs) by Benchmark::BEGIN@426 at line 426 of Benchmark.pm
# once (5µs+7µs) by NetAddr::IP::Lite::BEGIN@170 at line 170 of NetAddr/IP/Lite.pm
# once (5µs+6µs) by Socket::BEGIN@240 at line 240 of Socket.pm
# once (5µs+6µs) by Carp::BEGIN@67 at line 67 of Carp.pm
# once (5µs+6µs) by AutoLoader::BEGIN@194 at line 194 of AutoLoader.pm
# once (5µs+5µs) by Config::BEGIN@47 at line 47 of Config.pm
# once (5µs+5µs) by Time::HiRes::BEGIN@43 at line 43 of Time/HiRes.pm
# once (5µs+5µs) by AutoLoader::BEGIN@37 at line 37 of AutoLoader.pm
# once (5µs+5µs) by Carp::BEGIN@18 at line 18 of Carp.pm
# once (4µs+5µs) by Carp::BEGIN@448 at line 448 of Carp.pm
# once (4µs+5µs) by Carp::BEGIN@8 at line 8 of Carp.pm
# once (4µs+4µs) by Exporter::Heavy::BEGIN@4 at line 4 of Exporter/Heavy.pm | ||||
48 | 14 | 2µs | shift; | ||
49 | 14 | 58µs | 14 | 85µs | $^H &= ~ bits(@_ ? @_ : @default_bits); # spent 85µs making 14 calls to strict::bits, avg 6µs/call |
50 | } | ||||
51 | |||||
52 | 1 | 16µs | 1; | ||
53 | __END__ | ||||
# spent 10µs within strict::CORE:match which was called:
# once (10µs+0s) by main::BEGIN@1 at line 6 | |||||
# spent 29µs within strict::CORE:regcomp which was called:
# once (29µs+0s) by main::BEGIN@1 at line 6 |