File | /usr/local/lib/perl5/5.10.1/warnings/register.pm |
Statements Executed | 333 |
Statement Execution Time | 407µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
5 | 5 | 5 | 390µs | 450µs | import | warnings::register::
10 | 2 | 1 | 60µs | 60µs | mkMask | warnings::register::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package warnings::register; | ||||
2 | |||||
3 | 1 | 700ns | our $VERSION = '1.01'; | ||
4 | |||||
5 | =pod | ||||
6 | |||||
7 | =head1 NAME | ||||
8 | |||||
9 | warnings::register - warnings import function | ||||
10 | |||||
11 | =head1 SYNOPSIS | ||||
12 | |||||
13 | use warnings::register; | ||||
14 | |||||
15 | =head1 DESCRIPTION | ||||
16 | |||||
17 | Creates a warnings category with the same name as the current package. | ||||
18 | |||||
19 | See L<warnings> and L<perllexwarn> for more information on this module's | ||||
20 | usage. | ||||
21 | |||||
22 | =cut | ||||
23 | |||||
24 | 1 | 300ns | require warnings; | ||
25 | |||||
26 | sub mkMask | ||||
27 | { | ||||
28 | 10 | 8µs | my ($bit) = @_; | ||
29 | 10 | 7µs | my $mask = ""; | ||
30 | |||||
31 | 10 | 15µs | vec($mask, $bit, 1) = 1; | ||
32 | 10 | 45µs | return $mask; | ||
33 | } | ||||
34 | |||||
35 | sub import | ||||
36 | # spent 450µs (390+60) within warnings::register::import which was called 5 times, avg 90µs/call:
# once (93µs+21µs) by overload::BEGIN@139 at line 139 of overload.pm
# once (79µs+10µs) by IO::Select::BEGIN@10 at line 10 of IO/Select.pm
# once (77µs+11µs) by constant::BEGIN@4 at line 4 of constant.pm
# once (72µs+10µs) by Socket::BEGIN@179 at line 179 of Socket.pm
# once (67µs+8µs) by vars::BEGIN@7 at line 7 of vars.pm | ||||
37 | 5 | 3µs | shift; | ||
38 | 5 | 28µs | my $package = (caller(0))[0]; | ||
39 | 5 | 28µs | if (! defined $warnings::Bits{$package}) { | ||
40 | 5 | 22µs | 5 | 43µs | $warnings::Bits{$package} = mkMask($warnings::LAST_BIT); # spent 43µs making 5 calls to warnings::register::mkMask, avg 9µs/call |
41 | 5 | 8µs | vec($warnings::Bits{'all'}, $warnings::LAST_BIT, 1) = 1; | ||
42 | 5 | 7µs | $warnings::Offsets{$package} = $warnings::LAST_BIT ++; | ||
43 | 5 | 69µs | foreach my $k (keys %warnings::Bits) { | ||
44 | 245 | 139µs | vec($warnings::Bits{$k}, $warnings::LAST_BIT, 1) = 0; | ||
45 | } | ||||
46 | 5 | 13µs | 5 | 17µs | $warnings::DeadBits{$package} = mkMask($warnings::LAST_BIT); # spent 17µs making 5 calls to warnings::register::mkMask, avg 3µs/call |
47 | 5 | 12µs | vec($warnings::DeadBits{'all'}, $warnings::LAST_BIT++, 1) = 1; | ||
48 | } | ||||
49 | } | ||||
50 | |||||
51 | 1 | 4µs | 1; |