Filename | /usr/lib/perl5/5.12.4/warnings/register.pm |
Statements | Executed 273 statements in 2.60ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 4 | 4 | 2.25ms | 2.54ms | import | warnings::register::
8 | 2 | 1 | 293µs | 293µs | mkMask | warnings::register::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package warnings::register; | ||||
2 | |||||
3 | 1 | 6µs | 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 | 4µs | require warnings; | ||
25 | |||||
26 | sub mkMask | ||||
27 | { | ||||
28 | 8 | 38µs | my ($bit) = @_; | ||
29 | 8 | 38µs | my $mask = ""; | ||
30 | |||||
31 | 8 | 92µs | vec($mask, $bit, 1) = 1; | ||
32 | 8 | 195µs | return $mask; | ||
33 | } | ||||
34 | |||||
35 | sub import | ||||
36 | # spent 2.54ms (2.25+293µs) within warnings::register::import which was called 4 times, avg 635µs/call:
# once (585µs+73µs) by vars::BEGIN@7 at line 7 of vars.pm
# once (569µs+67µs) by overload::BEGIN@145 at line 145 of overload.pm
# once (551µs+85µs) by Tie::Hash::BEGIN@189 at line 189 of Tie/Hash.pm
# once (541µs+68µs) by constant::BEGIN@4 at line 4 of constant.pm | ||||
37 | 4 | 14µs | shift; | ||
38 | 4 | 65µs | my $package = (caller(0))[0]; | ||
39 | 4 | 107µs | if (! defined $warnings::Bits{$package}) { | ||
40 | 4 | 73µs | 4 | 171µs | $warnings::Bits{$package} = mkMask($warnings::LAST_BIT); # spent 171µs making 4 calls to warnings::register::mkMask, avg 43µs/call |
41 | 4 | 33µs | vec($warnings::Bits{'all'}, $warnings::LAST_BIT, 1) = 1; | ||
42 | 4 | 23µs | $warnings::Offsets{$package} = $warnings::LAST_BIT ++; | ||
43 | 4 | 178µs | foreach my $k (keys %warnings::Bits) { | ||
44 | 202 | 1.60ms | vec($warnings::Bits{$k}, $warnings::LAST_BIT, 1) = 0; | ||
45 | } | ||||
46 | 4 | 70µs | 4 | 122µs | $warnings::DeadBits{$package} = mkMask($warnings::LAST_BIT); # spent 122µs making 4 calls to warnings::register::mkMask, avg 30µs/call |
47 | 4 | 48µs | vec($warnings::DeadBits{'all'}, $warnings::LAST_BIT++, 1) = 1; | ||
48 | } | ||||
49 | } | ||||
50 | |||||
51 | 1 | 16µs | 1; |