Filename | /usr/share/perl/5.18/warnings.pm |
Statements | Executed 1815 statements in 2.34ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
48 | 48 | 42 | 546µs | 546µs | unimport | warnings::
86 | 51 | 49 | 516µs | 783µs | import | warnings::
6 | 1 | 1 | 396µs | 437µs | register_categories | warnings::
40 | 1 | 1 | 267µs | 267µs | _bits | warnings::
12 | 2 | 1 | 41µs | 41µs | _mkMask | warnings::
1 | 1 | 1 | 15µs | 15µs | CORE:regcomp (opcode) | warnings::
1 | 1 | 1 | 4µs | 4µs | CORE:match (opcode) | warnings::
0 | 0 | 0 | 0s | 0s | Croaker | warnings::
0 | 0 | 0 | 0s | 0s | __chk | warnings::
0 | 0 | 0 | 0s | 0s | _error_loc | warnings::
0 | 0 | 0 | 0s | 0s | bits | warnings::
0 | 0 | 0 | 0s | 0s | enabled | warnings::
0 | 0 | 0 | 0s | 0s | fatal_enabled | warnings::
0 | 0 | 0 | 0s | 0s | warn | warnings::
0 | 0 | 0 | 0s | 0s | warnif | warnings::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # -*- buffer-read-only: t -*- | ||||
2 | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!! | ||||
3 | # This file is built by regen/warnings.pl. | ||||
4 | # Any changes made here will be lost! | ||||
5 | |||||
6 | package warnings; | ||||
7 | |||||
8 | 1 | 700ns | our $VERSION = '1.18'; | ||
9 | |||||
10 | # Verify that we're called correctly so that warnings will work. | ||||
11 | # see also strict.pm. | ||||
12 | 1 | 30µs | 2 | 19µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 15µs making 1 call to warnings::CORE:regcomp
# spent 4µs making 1 call to warnings::CORE:match |
13 | my (undef, $f, $l) = caller; | ||||
14 | die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n"); | ||||
15 | } | ||||
16 | |||||
17 | 1 | 17µs | our %Offsets = ( | ||
18 | |||||
19 | # Warnings Categories added in Perl 5.008 | ||||
20 | |||||
21 | 'all' => 0, | ||||
22 | 'closure' => 2, | ||||
23 | 'deprecated' => 4, | ||||
24 | 'exiting' => 6, | ||||
25 | 'glob' => 8, | ||||
26 | 'io' => 10, | ||||
27 | 'closed' => 12, | ||||
28 | 'exec' => 14, | ||||
29 | 'layer' => 16, | ||||
30 | 'newline' => 18, | ||||
31 | 'pipe' => 20, | ||||
32 | 'unopened' => 22, | ||||
33 | 'misc' => 24, | ||||
34 | 'numeric' => 26, | ||||
35 | 'once' => 28, | ||||
36 | 'overflow' => 30, | ||||
37 | 'pack' => 32, | ||||
38 | 'portable' => 34, | ||||
39 | 'recursion' => 36, | ||||
40 | 'redefine' => 38, | ||||
41 | 'regexp' => 40, | ||||
42 | 'severe' => 42, | ||||
43 | 'debugging' => 44, | ||||
44 | 'inplace' => 46, | ||||
45 | 'internal' => 48, | ||||
46 | 'malloc' => 50, | ||||
47 | 'signal' => 52, | ||||
48 | 'substr' => 54, | ||||
49 | 'syntax' => 56, | ||||
50 | 'ambiguous' => 58, | ||||
51 | 'bareword' => 60, | ||||
52 | 'digit' => 62, | ||||
53 | 'parenthesis' => 64, | ||||
54 | 'precedence' => 66, | ||||
55 | 'printf' => 68, | ||||
56 | 'prototype' => 70, | ||||
57 | 'qw' => 72, | ||||
58 | 'reserved' => 74, | ||||
59 | 'semicolon' => 76, | ||||
60 | 'taint' => 78, | ||||
61 | 'threads' => 80, | ||||
62 | 'uninitialized' => 82, | ||||
63 | 'unpack' => 84, | ||||
64 | 'untie' => 86, | ||||
65 | 'utf8' => 88, | ||||
66 | 'void' => 90, | ||||
67 | |||||
68 | # Warnings Categories added in Perl 5.011 | ||||
69 | |||||
70 | 'imprecision' => 92, | ||||
71 | 'illegalproto' => 94, | ||||
72 | |||||
73 | # Warnings Categories added in Perl 5.013 | ||||
74 | |||||
75 | 'non_unicode' => 96, | ||||
76 | 'nonchar' => 98, | ||||
77 | 'surrogate' => 100, | ||||
78 | |||||
79 | # Warnings Categories added in Perl 5.017 | ||||
80 | |||||
81 | 'experimental' => 102, | ||||
82 | 'experimental::lexical_subs'=> 104, | ||||
83 | 'experimental::lexical_topic'=> 106, | ||||
84 | 'experimental::regex_sets'=> 108, | ||||
85 | 'experimental::smartmatch'=> 110, | ||||
86 | ); | ||||
87 | |||||
88 | 1 | 22µs | our %Bits = ( | ||
89 | 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..55] | ||||
90 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [29] | ||||
91 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [30] | ||||
92 | 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
93 | 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
94 | 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
95 | 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
96 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [31] | ||||
97 | 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
98 | 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
99 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55", # [51..55] | ||||
100 | 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [52] | ||||
101 | 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [53] | ||||
102 | 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [54] | ||||
103 | 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40", # [55] | ||||
104 | 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
105 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [47] | ||||
106 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [46] | ||||
107 | 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
108 | 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
109 | 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [5..11] | ||||
110 | 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
111 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
112 | 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
113 | 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
114 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [48] | ||||
115 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [49] | ||||
116 | 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
117 | 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
118 | 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
119 | 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
120 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00", # [32] | ||||
121 | 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
122 | 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
123 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [33] | ||||
124 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [34] | ||||
125 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [35] | ||||
126 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [36] | ||||
127 | 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
128 | 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
129 | 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
130 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [37] | ||||
131 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [38] | ||||
132 | 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
133 | 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
134 | 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
135 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [50] | ||||
136 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00", # [28..38,47] | ||||
137 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [39] | ||||
138 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [40] | ||||
139 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [41] | ||||
140 | 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
141 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [42] | ||||
142 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [43] | ||||
143 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00", # [44,48..50] | ||||
144 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [45] | ||||
145 | ); | ||||
146 | |||||
147 | 1 | 17µs | our %DeadBits = ( | ||
148 | 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..55] | ||||
149 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [29] | ||||
150 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [30] | ||||
151 | 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
152 | 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
153 | 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
154 | 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
155 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [31] | ||||
156 | 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
157 | 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
158 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa", # [51..55] | ||||
159 | 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [52] | ||||
160 | 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [53] | ||||
161 | 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [54] | ||||
162 | 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80", # [55] | ||||
163 | 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
164 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [47] | ||||
165 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [46] | ||||
166 | 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
167 | 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
168 | 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [5..11] | ||||
169 | 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
170 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
171 | 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
172 | 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
173 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [48] | ||||
174 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [49] | ||||
175 | 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
176 | 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
177 | 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
178 | 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
179 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00", # [32] | ||||
180 | 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
181 | 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
182 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [33] | ||||
183 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [34] | ||||
184 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [35] | ||||
185 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [36] | ||||
186 | 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
187 | 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
188 | 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
189 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [37] | ||||
190 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [38] | ||||
191 | 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
192 | 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
193 | 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
194 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [50] | ||||
195 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00", # [28..38,47] | ||||
196 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [39] | ||||
197 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [40] | ||||
198 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [41] | ||||
199 | 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
200 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [42] | ||||
201 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [43] | ||||
202 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00", # [44,48..50] | ||||
203 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [45] | ||||
204 | ); | ||||
205 | |||||
206 | 1 | 200ns | $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | ||
207 | 1 | 600ns | $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55", # [2,52..55,4,22,23,25] | ||
208 | $LAST_BIT = 112 ; | ||||
209 | 1 | 200ns | $BYTES = 14 ; | ||
210 | |||||
211 | 2 | 5µs | $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; | ||
212 | |||||
213 | sub Croaker | ||||
214 | { | ||||
215 | require Carp; # this initializes %CarpInternal | ||||
216 | local $Carp::CarpInternal{'warnings'}; | ||||
217 | delete $Carp::CarpInternal{'warnings'}; | ||||
218 | Carp::croak(@_); | ||||
219 | } | ||||
220 | |||||
221 | # spent 267µs within warnings::_bits which was called 40 times, avg 7µs/call:
# 40 times (267µs+0s) by warnings::import at line 267, avg 7µs/call | ||||
222 | 40 | 13µs | my $mask = shift ; | ||
223 | 40 | 4µs | my $catmask ; | ||
224 | 40 | 8µs | my $fatal = 0 ; | ||
225 | 40 | 5µs | my $no_fatal = 0 ; | ||
226 | |||||
227 | 40 | 26µs | foreach my $word ( @_ ) { | ||
228 | 80 | 88µs | if ($word eq 'FATAL') { | ||
229 | 40 | 6µs | $fatal = 1; | ||
230 | 40 | 9µs | $no_fatal = 0; | ||
231 | } | ||||
232 | elsif ($word eq 'NONFATAL') { | ||||
233 | $fatal = 0; | ||||
234 | $no_fatal = 1; | ||||
235 | } | ||||
236 | elsif ($catmask = $Bits{$word}) { | ||||
237 | 40 | 26µs | $mask |= $catmask ; | ||
238 | 40 | 25µs | $mask |= $DeadBits{$word} if $fatal ; | ||
239 | 40 | 6µs | $mask &= ~($DeadBits{$word}|$All) if $no_fatal ; | ||
240 | } | ||||
241 | else | ||||
242 | { Croaker("Unknown warnings category '$word'")} | ||||
243 | } | ||||
244 | |||||
245 | 40 | 118µs | return $mask ; | ||
246 | } | ||||
247 | |||||
248 | sub bits | ||||
249 | { | ||||
250 | # called from B::Deparse.pm | ||||
251 | push @_, 'all' unless @_ ; | ||||
252 | return _bits(undef, @_) ; | ||||
253 | } | ||||
254 | |||||
255 | sub import | ||||
256 | # spent 783µs (516+267) within warnings::import which was called 86 times, avg 9µs/call:
# 36 times (232µs+237µs) by strictures::import at line 34 of strictures.pm, avg 13µs/call
# once (14µs+9µs) by strictures::BEGIN@4 at line 4 of strictures.pm
# once (18µs+0s) by Config::BEGIN@6 at line 6 of Config_heavy.pl
# once (8µs+7µs) by JSON::MaybeXS::BEGIN@4 at line 4 of /opt/flows/lib/lib/perl5/JSON/MaybeXS.pm
# once (8µs+7µs) by Import::Into::BEGIN@4 at line 4 of Import/Into.pm
# once (8µs+7µs) by Role::Tiny::BEGIN@7 at line 7 of Role/Tiny.pm
# once (7µs+0s) by HTTP::Tiny::Handle::BEGIN@979 at line 979 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (7µs+0s) by main::BEGIN@4 at line 4 of flows_to_es.pl
# once (6µs+0s) by overloading::BEGIN@2 at line 2 of overloading.pm
# once (6µs+0s) by namespace::clean::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/namespace/clean.pm
# once (6µs+0s) by namespace::clean::_Util::BEGIN@12 at line 12 of /opt/flows/lib/lib/perl5/namespace/clean/_Util.pm
# once (5µs+0s) by Try::Tiny::BEGIN@10 at line 10 of Try/Tiny.pm
# once (5µs+0s) by Encode::Alias::BEGIN@3 at line 3 of Encode/Alias.pm
# once (5µs+0s) by POSIX::BEGIN@3 at line 3 of POSIX.pm
# once (5µs+0s) by Search::Elasticsearch::Util::API::QS::BEGIN@4 at line 4 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/QS.pm
# once (5µs+0s) by Package::Stash::BEGIN@9 at line 9 of Package/Stash.pm
# once (5µs+0s) by File::Copy::BEGIN@12 at line 12 of File/Copy.pm
# once (5µs+0s) by InfluxDB::LineProtocol::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/InfluxDB/LineProtocol.pm
# once (5µs+0s) by Search::Elasticsearch::Logger::LogAny::BEGIN@3.12 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Adapter.pm
# once (5µs+0s) by File::Basename::BEGIN@52 at line 52 of File/Basename.pm
# once (5µs+0s) by Search::Elasticsearch::Logger::LogAny::BEGIN@3.6 at line 3 of /opt/flows/lib/lib/perl5/Log/Any.pm
# once (5µs+0s) by Log::Any::Manager::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Null.pm
# once (5µs+0s) by Encode::Config::BEGIN@8 at line 8 of Encode/Config.pm
# once (5µs+0s) by Log::Any::Adapter::Util::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Proxy.pm
# once (5µs+0s) by Devel::GlobalDestruction::BEGIN@4 at line 4 of Devel/GlobalDestruction.pm
# once (5µs+0s) by Data::OptList::BEGIN@2 at line 2 of /opt/flows/lib/lib/perl5/Sub/Install.pm
# once (5µs+0s) by Class::XSAccessor::BEGIN@4 at line 4 of Class/XSAccessor.pm
# once (5µs+0s) by Carp::BEGIN@5 at line 5 of Carp.pm
# once (5µs+0s) by Encode::BEGIN@6 at line 6 of Encode.pm
# once (5µs+0s) by Search::Elasticsearch::Util::BEGIN@3.2 at line 3 of /opt/flows/lib/lib/perl5/Sub/Exporter.pm
# once (5µs+0s) by B::Hooks::EndOfScope::XS::BEGIN@5 at line 5 of /opt/flows/lib/lib/perl5/B/Hooks/EndOfScope/XS.pm
# once (5µs+0s) by Class::Method::Modifiers::BEGIN@11 at line 11 of Class/Method/Modifiers.pm
# once (5µs+0s) by HTTP::Tiny::BEGIN@4 at line 4 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (5µs+0s) by Search::Elasticsearch::Util::API::Path::BEGIN@4 at line 4 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/Path.pm
# once (5µs+0s) by Config::BEGIN@10 at line 10 of Config.pm
# once (5µs+0s) by Sub::Exporter::Progressive::BEGIN@4 at line 4 of Sub/Exporter/Progressive.pm
# once (5µs+0s) by Class::XSAccessor::Heavy::BEGIN@6 at line 6 of Class/XSAccessor/Heavy.pm
# once (5µs+0s) by Sub::Name::BEGIN@45 at line 45 of Sub/Name.pm
# once (5µs+0s) by Module::Implementation::BEGIN@10 at line 10 of Module/Implementation.pm
# once (5µs+0s) by Log::Any::BEGIN@3.9 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Util.pm
# once (5µs+0s) by Encode::Encoding::BEGIN@5 at line 5 of Encode/Encoding.pm
# once (5µs+0s) by Package::Stash::XS::BEGIN@9 at line 9 of Package/Stash/XS.pm
# once (5µs+0s) by IO::BEGIN@8 at line 8 of IO.pm
# once (5µs+0s) by Log::Any::Adapter::Null::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Base.pm
# once (5µs+0s) by Log::Any::BEGIN@3 at line 3 of /opt/flows/lib/lib/perl5/Log/Any/Manager.pm
# once (5µs+0s) by Variable::Magic::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/x86_64-linux-gnu-thread-multi/Variable/Magic.pm
# once (5µs+0s) by mro::BEGIN@11 at line 11 of mro.pm
# once (5µs+0s) by B::Hooks::EndOfScope::BEGIN@6 at line 6 of /opt/flows/lib/lib/perl5/B/Hooks/EndOfScope.pm
# once (4µs+0s) by Sub::Exporter::BEGIN@2 at line 2 of /opt/flows/lib/lib/perl5/Data/OptList.pm
# once (4µs+0s) by main::BEGIN@2 at line 2 of local/lib.pm
# once (4µs+0s) by Any::URI::Escape::BEGIN@4 at line 4 of /opt/flows/lib/lib/perl5/Any/URI/Escape.pm | ||||
257 | 86 | 13µs | shift; | ||
258 | |||||
259 | 86 | 114µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
260 | |||||
261 | 86 | 90µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
262 | 2 | 2µs | $mask |= $Bits{'all'} ; | ||
263 | 2 | 2µs | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||
264 | } | ||||
265 | |||||
266 | # Empty @_ is equivalent to @_ = 'all' ; | ||||
267 | 86 | 448µs | 40 | 267µs | ${^WARNING_BITS} = @_ ? _bits($mask, @_) : $mask | $Bits{all} ; # spent 267µs making 40 calls to warnings::_bits, avg 7µs/call |
268 | } | ||||
269 | |||||
270 | sub unimport | ||||
271 | # spent 546µs within warnings::unimport which was called 48 times, avg 11µs/call:
# once (20µs+0s) by Class::XSAccessor::Heavy::BEGIN@30 at line 30 of Class/XSAccessor/Heavy.pm
# once (20µs+0s) by Sub::Quote::BEGIN@3.36 at line 3 of (eval 108)[Sub/Quote.pm:5]
# once (15µs+0s) by Role::Tiny::BEGIN@352 at line 352 of Role/Tiny.pm
# once (14µs+0s) by Sub::Quote::BEGIN@3.40 at line 3 of (eval 110)[Sub/Quote.pm:5]
# once (12µs+0s) by Class::XSAccessor::BEGIN@84 at line 84 of Class/XSAccessor.pm
# once (12µs+0s) by HTTP::Tiny::Handle::BEGIN@1594 at line 1594 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (12µs+0s) by Search::Elasticsearch::Util::API::QS::BEGIN@283 at line 283 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/QS.pm
# once (12µs+0s) by Log::Any::Adapter::Util::BEGIN@151 at line 151 of /opt/flows/lib/lib/perl5/Log/Any/Adapter/Util.pm
# once (12µs+0s) by Encode::BEGIN@240 at line 240 of Encode.pm
# once (12µs+0s) by Search::Elasticsearch::Util::API::Path::BEGIN@18 at line 18 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Util/API/Path.pm
# once (12µs+0s) by Devel::GlobalDestruction::BEGIN@23 at line 23 of Devel/GlobalDestruction.pm
# once (11µs+0s) by File::Copy::BEGIN@12.1 at line 12 of File/Copy.pm
# once (11µs+0s) by Log::Any::BEGIN@72 at line 72 of /opt/flows/lib/lib/perl5/Log/Any.pm
# once (11µs+0s) by Sub::Quote::BEGIN@3.38 at line 3 of (eval 109)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.28 at line 3 of (eval 96)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.3 at line 3 of (eval 46)[Sub/Quote.pm:5]
# once (11µs+0s) by Search::Elasticsearch::Role::Cxn::HTTP::BEGIN@146 at line 146 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Cxn/HTTP.pm
# once (11µs+0s) by Moo::BEGIN@110 at line 110 of Moo.pm
# once (11µs+0s) by Sub::Quote::BEGIN@5 at line 5 of (eval 87)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.13 at line 3 of (eval 56)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@5.42 at line 5 of (eval 113)[Sub/Quote.pm:5]
# once (11µs+0s) by Moo::_Utils::BEGIN@83 at line 83 of Moo/_Utils.pm
# once (11µs+0s) by Log::Any::Manager::BEGIN@36 at line 36 of /opt/flows/lib/lib/perl5/Log/Any/Manager.pm
# once (11µs+0s) by Carp::BEGIN@434 at line 434 of Carp.pm
# once (11µs+0s) by Sub::Defer::BEGIN@26 at line 26 of Sub/Defer.pm
# once (11µs+0s) by Sub::Quote::BEGIN@3.34 at line 3 of (eval 107)[Sub/Quote.pm:5]
# once (11µs+0s) by Moo::HandleMoose::_TypeMap::BEGIN@20 at line 20 of Moo/HandleMoose/_TypeMap.pm
# once (11µs+0s) by Module::Implementation::BEGIN@124 at line 124 of Module/Implementation.pm
# once (11µs+0s) by Sub::Quote::BEGIN@3.22 at line 3 of (eval 89)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@4.19 at line 4 of (eval 86)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.17 at line 3 of (eval 71)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@4 at line 4 of (eval 52)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.30 at line 3 of (eval 104)[Sub/Quote.pm:5]
# once (11µs+0s) by Moo::Object::BEGIN@68 at line 68 of Moo/Object.pm
# once (11µs+0s) by Sub::Quote::BEGIN@3.26 at line 3 of (eval 93)[Sub/Quote.pm:5]
# once (11µs+0s) by Sub::Quote::BEGIN@3.15 at line 3 of (eval 58)[Sub/Quote.pm:5]
# once (11µs+0s) by strictures::BEGIN@22 at line 22 of strictures.pm
# once (11µs+0s) by Class::Method::Modifiers::BEGIN@204 at line 204 of Class/Method/Modifiers.pm
# once (11µs+0s) by Class::Method::Modifiers::BEGIN@150 at line 150 of Class/Method/Modifiers.pm
# once (10µs+0s) by Sub::Quote::BEGIN@3.24 at line 3 of (eval 90)[Sub/Quote.pm:5]
# once (10µs+0s) by Sub::Quote::BEGIN@3.32 at line 3 of (eval 105)[Sub/Quote.pm:5]
# once (10µs+0s) by Role::Tiny::BEGIN@402 at line 402 of Role/Tiny.pm
# once (10µs+0s) by HTTP::Tiny::BEGIN@75 at line 75 of /opt/flows/lib/lib/perl5/HTTP/Tiny.pm
# once (10µs+0s) by Carp::BEGIN@441 at line 441 of Carp.pm
# once (10µs+0s) by Encode::Alias::BEGIN@4 at line 4 of Encode/Alias.pm
# once (10µs+0s) by Exporter::Heavy::BEGIN@183 at line 183 of Exporter/Heavy.pm
# once (9µs+0s) by Moo::_Utils::BEGIN@3 at line 3 of Moo/_Utils.pm
# once (7µs+0s) by Class::Method::Modifiers::BEGIN@151 at line 151 of Class/Method/Modifiers.pm | ||||
272 | 48 | 10µs | shift; | ||
273 | |||||
274 | 48 | 8µs | my $catmask ; | ||
275 | 48 | 86µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
276 | |||||
277 | 48 | 68µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
278 | 45 | 33µs | $mask |= $Bits{'all'} ; | ||
279 | 45 | 43µs | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||
280 | } | ||||
281 | |||||
282 | 48 | 13µs | push @_, 'all' unless @_; | ||
283 | |||||
284 | 48 | 49µs | foreach my $word ( @_ ) { | ||
285 | 48 | 142µs | if ($word eq 'FATAL') { | ||
286 | next; | ||||
287 | } | ||||
288 | elsif ($catmask = $Bits{$word}) { | ||||
289 | $mask &= ~($catmask | $DeadBits{$word} | $All); | ||||
290 | } | ||||
291 | else | ||||
292 | { Croaker("Unknown warnings category '$word'")} | ||||
293 | } | ||||
294 | |||||
295 | 48 | 301µs | ${^WARNING_BITS} = $mask ; | ||
296 | } | ||||
297 | |||||
298 | 2 | 7µs | my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = (); | ||
299 | |||||
300 | sub MESSAGE () { 4 }; | ||||
301 | sub FATAL () { 2 }; | ||||
302 | sub NORMAL () { 1 }; | ||||
303 | |||||
304 | sub __chk | ||||
305 | { | ||||
306 | my $category ; | ||||
307 | my $offset ; | ||||
308 | my $isobj = 0 ; | ||||
309 | my $wanted = shift; | ||||
310 | my $has_message = $wanted & MESSAGE; | ||||
311 | |||||
312 | unless (@_ == 1 || @_ == ($has_message ? 2 : 0)) { | ||||
313 | my $sub = (caller 1)[3]; | ||||
314 | my $syntax = $has_message ? "[category,] 'message'" : '[category]'; | ||||
315 | Croaker("Usage: $sub($syntax)"); | ||||
316 | } | ||||
317 | |||||
318 | my $message = pop if $has_message; | ||||
319 | |||||
320 | if (@_) { | ||||
321 | # check the category supplied. | ||||
322 | $category = shift ; | ||||
323 | if (my $type = ref $category) { | ||||
324 | Croaker("not an object") | ||||
325 | if exists $builtin_type{$type}; | ||||
326 | $category = $type; | ||||
327 | $isobj = 1 ; | ||||
328 | } | ||||
329 | $offset = $Offsets{$category}; | ||||
330 | Croaker("Unknown warnings category '$category'") | ||||
331 | unless defined $offset; | ||||
332 | } | ||||
333 | else { | ||||
334 | $category = (caller(1))[0] ; | ||||
335 | $offset = $Offsets{$category}; | ||||
336 | Croaker("package '$category' not registered for warnings") | ||||
337 | unless defined $offset ; | ||||
338 | } | ||||
339 | |||||
340 | my $i; | ||||
341 | |||||
342 | if ($isobj) { | ||||
343 | my $pkg; | ||||
344 | $i = 2; | ||||
345 | while (do { { package DB; $pkg = (caller($i++))[0] } } ) { | ||||
346 | last unless @DB::args && $DB::args[0] =~ /^$category=/ ; | ||||
347 | } | ||||
348 | $i -= 2 ; | ||||
349 | } | ||||
350 | else { | ||||
351 | $i = _error_loc(); # see where Carp will allocate the error | ||||
352 | } | ||||
353 | |||||
354 | # Default to 0 if caller returns nothing. Default to $DEFAULT if it | ||||
355 | # explicitly returns undef. | ||||
356 | my(@callers_bitmask) = (caller($i))[9] ; | ||||
357 | my $callers_bitmask = | ||||
358 | @callers_bitmask ? $callers_bitmask[0] // $DEFAULT : 0 ; | ||||
359 | |||||
360 | my @results; | ||||
361 | foreach my $type (FATAL, NORMAL) { | ||||
362 | next unless $wanted & $type; | ||||
363 | |||||
364 | push @results, (vec($callers_bitmask, $offset + $type - 1, 1) || | ||||
365 | vec($callers_bitmask, $Offsets{'all'} + $type - 1, 1)); | ||||
366 | } | ||||
367 | |||||
368 | # &enabled and &fatal_enabled | ||||
369 | return $results[0] unless $has_message; | ||||
370 | |||||
371 | # &warnif, and the category is neither enabled as warning nor as fatal | ||||
372 | return if $wanted == (NORMAL | FATAL | MESSAGE) | ||||
373 | && !($results[0] || $results[1]); | ||||
374 | |||||
375 | require Carp; | ||||
376 | Carp::croak($message) if $results[0]; | ||||
377 | # will always get here for &warn. will only get here for &warnif if the | ||||
378 | # category is enabled | ||||
379 | Carp::carp($message); | ||||
380 | } | ||||
381 | |||||
382 | sub _mkMask | ||||
383 | { | ||||
384 | 12 | 4µs | my ($bit) = @_; | ||
385 | 12 | 3µs | my $mask = ""; | ||
386 | |||||
387 | 12 | 16µs | vec($mask, $bit, 1) = 1; | ||
388 | 12 | 59µs | return $mask; | ||
389 | } | ||||
390 | |||||
391 | sub register_categories | ||||
392 | # spent 437µs (396+41) within warnings::register_categories which was called 6 times, avg 73µs/call:
# 6 times (396µs+41µs) by warnings::register::import at line 24 of warnings/register.pm, avg 73µs/call | ||||
393 | 6 | 3µs | my @names = @_; | ||
394 | |||||
395 | 6 | 19µs | for my $name (@names) { | ||
396 | 6 | 10µs | if (! defined $Bits{$name}) { | ||
397 | 6 | 12µs | 6 | 27µs | $Bits{$name} = _mkMask($LAST_BIT); # spent 27µs making 6 calls to warnings::_mkMask, avg 4µs/call |
398 | 6 | 9µs | vec($Bits{'all'}, $LAST_BIT, 1) = 1; | ||
399 | 6 | 4µs | $Offsets{$name} = $LAST_BIT ++; | ||
400 | 6 | 45µs | foreach my $k (keys %Bits) { | ||
401 | 357 | 238µs | vec($Bits{$k}, $LAST_BIT, 1) = 0; | ||
402 | } | ||||
403 | 6 | 10µs | 6 | 14µs | $DeadBits{$name} = _mkMask($LAST_BIT); # spent 14µs making 6 calls to warnings::_mkMask, avg 2µs/call |
404 | 6 | 8µs | vec($DeadBits{'all'}, $LAST_BIT++, 1) = 1; | ||
405 | } | ||||
406 | } | ||||
407 | } | ||||
408 | |||||
409 | sub _error_loc { | ||||
410 | require Carp; | ||||
411 | goto &Carp::short_error_loc; # don't introduce another stack frame | ||||
412 | } | ||||
413 | |||||
414 | sub enabled | ||||
415 | { | ||||
416 | return __chk(NORMAL, @_); | ||||
417 | } | ||||
418 | |||||
419 | sub fatal_enabled | ||||
420 | { | ||||
421 | return __chk(FATAL, @_); | ||||
422 | } | ||||
423 | |||||
424 | sub warn | ||||
425 | { | ||||
426 | return __chk(FATAL | MESSAGE, @_); | ||||
427 | } | ||||
428 | |||||
429 | sub warnif | ||||
430 | { | ||||
431 | return __chk(NORMAL | FATAL | MESSAGE, @_); | ||||
432 | } | ||||
433 | |||||
434 | # These are not part of any public interface, so we can delete them to save | ||||
435 | # space. | ||||
436 | 1 | 5µs | delete @warnings::{qw(NORMAL FATAL MESSAGE)}; | ||
437 | |||||
438 | 1 | 37µs | 1; | ||
439 | |||||
440 | # ex: set ro: | ||||
# spent 4µs within warnings::CORE:match which was called:
# once (4µs+0s) by main::BEGIN@4 at line 12 | |||||
# spent 15µs within warnings::CORE:regcomp which was called:
# once (15µs+0s) by main::BEGIN@4 at line 12 |