Filename | /usr/share/perl/5.14/strict.pm |
Statements | Executed 170 statements in 314µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
15 | 3 | 1 | 76µs | 76µs | bits | strict::
13 | 13 | 7 | 73µs | 133µs | unimport | strict::
14 | 14 | 14 | 40µs | 44µs | import | strict::
1 | 1 | 1 | 21µs | 21µs | CORE:regcomp (opcode) | strict::
1 | 1 | 1 | 5µs | 5µs | CORE:match (opcode) | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | 1 | 900ns | $strict::VERSION = "1.04"; | ||
4 | |||||
5 | # Verify that we're called correctly so that strictures will work. | ||||
6 | 1 | 41µs | 2 | 26µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 21µs making 1 call to strict::CORE:regcomp
# spent 5µ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 | |||||
18 | sub bits { | ||||
19 | 75 | 72µs | my $bits = 0; | ||
20 | my @wrong; | ||||
21 | foreach my $s (@_) { | ||||
22 | 36 | 28µ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 | 3µs | 1 | 13µs | my $default_bits = bits(qw(refs subs vars)); # spent 13µs making 1 call to strict::bits |
33 | |||||
34 | # spent 44µs (40+3) within strict::import which was called 14 times, avg 3µs/call:
# once (4µs+3µs) by vars::BEGIN@8 at line 8 of vars.pm
# once (5µs+0s) by Carp::BEGIN@3 at line 3 of Carp.pm
# once (4µs+0s) by Tuple::BEGIN@3 at line 3 of /homes/dcw/lib/perl5/DCW/Tuple.pm
# once (3µs+0s) by List::BEGIN@10 at line 10 of /homes/dcw/lib/perl5/DCW/List.pm
# once (3µs+0s) by utf8::BEGIN@2 at line 2 of utf8_heavy.pl
# once (3µs+0s) by Sorthash::BEGIN@6 at line 6 of /homes/dcw/lib/perl5/DCW/Sorthash.pm
# once (2µs+0s) by AutoLoader::BEGIN@3 at line 3 of AutoLoader.pm
# once (2µs+0s) by constant::BEGIN@3 at line 3 of constant.pm
# once (2µs+0s) by parent::BEGIN@2 at line 2 of parent.pm
# once (2µs+0s) by Getopt::Long::BEGIN@17 at line 17 of Getopt/Long.pm
# once (2µs+0s) by Exporter::Heavy::BEGIN@3 at line 3 of Exporter/Heavy.pm
# once (2µs+0s) by Config::BEGIN@9 at line 9 of Config.pm
# once (2µs+0s) by lib::BEGIN@8 at line 8 of lib.pm
# once (2µs+0s) by Clone::BEGIN@4 at line 4 of Clone.pm | ||||
35 | 28 | 72µs | shift; | ||
36 | 1 | 3µs | $^H |= @_ ? bits(@_) : $default_bits; # spent 3µs making 1 call to strict::bits | ||
37 | } | ||||
38 | |||||
39 | # spent 133µs (73+60) within strict::unimport which was called 13 times, avg 10µs/call:
# once (15µs+8µs) by Carp::BEGIN@46 at line 46 of Carp.pm
# once (11µs+12µs) by Carp::BEGIN@341 at line 341 of Carp.pm
# once (7µs+6µs) by utf8::BEGIN@399 at line 399 of utf8_heavy.pl
# once (6µs+5µs) by utf8::BEGIN@123 at line 123 of utf8_heavy.pl
# once (4µs+3µs) by AutoLoader::BEGIN@138 at line 138 of AutoLoader.pm
# once (4µs+4µs) by constant::BEGIN@29 at line 29 of constant.pm
# once (4µs+3µs) by parent::BEGIN@25 at line 25 of parent.pm
# once (4µs+3µs) by Config::BEGIN@45 at line 45 of Config.pm
# once (4µs+3µs) by AutoLoader::BEGIN@30 at line 30 of AutoLoader.pm
# once (3µs+3µs) by Exporter::Heavy::BEGIN@4 at line 4 of Exporter/Heavy.pm
# once (4µs+3µs) by constant::BEGIN@114 at line 114 of constant.pm
# once (4µs+3µs) by AutoLoader::BEGIN@186 at line 186 of AutoLoader.pm
# once (4µs+3µs) by constant::BEGIN@52 at line 52 of constant.pm | ||||
40 | 26 | 79µs | shift; | ||
41 | 13 | 60µs | $^H &= ~ (@_ ? bits(@_) : $default_bits); # spent 60µs making 13 calls to strict::bits, avg 5µs/call | ||
42 | } | ||||
43 | |||||
44 | 1 | 16µs | 1; | ||
45 | __END__ | ||||
# spent 5µs within strict::CORE:match which was called:
# once (5µs+0s) by Carp::BEGIN@3 at line 6 | |||||
# spent 21µs within strict::CORE:regcomp which was called:
# once (21µs+0s) by Carp::BEGIN@3 at line 6 |