Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Statistics.pm |
Statements | Executed 44055 statements in 103ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
144 | 1 | 1 | 94.7ms | 5.32s | accumulate | Perl::Critic::Statistics::
30356 | 2 | 1 | 13.6ms | 13.6ms | CORE:match (opcode) | Perl::Critic::Statistics::
144 | 1 | 1 | 397µs | 397µs | CORE:regcomp (opcode) | Perl::Critic::Statistics::
1 | 1 | 1 | 17µs | 17µs | new | Perl::Critic::Statistics::
1 | 1 | 1 | 15µs | 15µs | BEGIN@10 | Perl::Critic::Statistics::
1 | 1 | 1 | 11µs | 32µs | BEGIN@16 | Perl::Critic::Statistics::
1 | 1 | 1 | 9µs | 410µs | BEGIN@14 | Perl::Critic::Statistics::
1 | 1 | 1 | 8µs | 13µs | BEGIN@12 | Perl::Critic::Statistics::
1 | 1 | 1 | 7µs | 19µs | BEGIN@11 | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | _subs_total_mccabe | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | average_sub_mccabe | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines_of_blank | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines_of_comment | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines_of_data | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines_of_perl | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | lines_of_pod | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | modules | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | statements | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | statements_other_than_subs | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | subs | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | total_violations | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | violations_by_policy | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | violations_by_severity | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | violations_per_file | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | violations_per_line_of_code | Perl::Critic::Statistics::
0 | 0 | 0 | 0s | 0s | violations_per_statement | Perl::Critic::Statistics::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ############################################################################## | ||||
2 | # $URL$ | ||||
3 | # $Date$ | ||||
4 | # $Author$ | ||||
5 | # $Revision$ | ||||
6 | ############################################################################## | ||||
7 | |||||
8 | package Perl::Critic::Statistics; | ||||
9 | |||||
10 | 2 | 39µs | 1 | 15µs | # spent 15µs within Perl::Critic::Statistics::BEGIN@10 which was called:
# once (15µs+0s) by Perl::Critic::BEGIN@27 at line 10 # spent 15µs making 1 call to Perl::Critic::Statistics::BEGIN@10 |
11 | 2 | 23µs | 2 | 31µs | # spent 19µs (7+12) within Perl::Critic::Statistics::BEGIN@11 which was called:
# once (7µs+12µs) by Perl::Critic::BEGIN@27 at line 11 # spent 19µs making 1 call to Perl::Critic::Statistics::BEGIN@11
# spent 12µs making 1 call to strict::import |
12 | 2 | 21µs | 2 | 18µs | # spent 13µs (8+5) within Perl::Critic::Statistics::BEGIN@12 which was called:
# once (8µs+5µs) by Perl::Critic::BEGIN@27 at line 12 # spent 13µs making 1 call to Perl::Critic::Statistics::BEGIN@12
# spent 5µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 26µs | 2 | 811µs | # spent 410µs (9+401) within Perl::Critic::Statistics::BEGIN@14 which was called:
# once (9µs+401µs) by Perl::Critic::BEGIN@27 at line 14 # spent 410µs making 1 call to Perl::Critic::Statistics::BEGIN@14
# spent 401µs making 1 call to English::import |
15 | |||||
16 | 2 | 762µs | 2 | 54µs | # spent 32µs (11+22) within Perl::Critic::Statistics::BEGIN@16 which was called:
# once (11µs+22µs) by Perl::Critic::BEGIN@27 at line 16 # spent 32µs making 1 call to Perl::Critic::Statistics::BEGIN@16
# spent 22µs making 1 call to Exporter::import |
17 | |||||
18 | #----------------------------------------------------------------------------- | ||||
19 | |||||
20 | 1 | 600ns | our $VERSION = '1.121'; | ||
21 | |||||
22 | #----------------------------------------------------------------------------- | ||||
23 | |||||
24 | # spent 17µs within Perl::Critic::Statistics::new which was called:
# once (17µs+0s) by Perl::Critic::new at line 43 of Perl/Critic.pm | ||||
25 | 1 | 700ns | my ( $class ) = @_; | ||
26 | |||||
27 | 1 | 3µs | my $self = bless {}, $class; | ||
28 | |||||
29 | 1 | 2µs | $self->{_modules} = 0; | ||
30 | 1 | 500ns | $self->{_subs} = 0; | ||
31 | 1 | 800ns | $self->{_statements} = 0; | ||
32 | 1 | 700ns | $self->{_lines} = 0; | ||
33 | 1 | 600ns | $self->{_lines_of_blank} = 0; | ||
34 | 1 | 800ns | $self->{_lines_of_comment} = 0; | ||
35 | 1 | 800ns | $self->{_lines_of_data} = 0; | ||
36 | 1 | 900ns | $self->{_lines_of_perl} = 0; | ||
37 | 1 | 500ns | $self->{_lines_of_pod} = 0; | ||
38 | 1 | 400ns | $self->{_violations_by_policy} = {}; | ||
39 | 1 | 300ns | $self->{_violations_by_severity} = {}; | ||
40 | 1 | 700ns | $self->{_total_violations} = 0; | ||
41 | |||||
42 | 1 | 4µs | return $self; | ||
43 | } | ||||
44 | |||||
45 | #----------------------------------------------------------------------------- | ||||
46 | |||||
47 | # spent 5.32s (94.7ms+5.22) within Perl::Critic::Statistics::accumulate which was called 144 times, avg 36.9ms/call:
# 144 times (94.7ms+5.22s) by Perl::Critic::_gather_violations at line 138 of Perl/Critic.pm, avg 36.9ms/call | ||||
48 | 144 | 74µs | my ($self, $doc, $violations) = @_; | ||
49 | |||||
50 | 144 | 87µs | $self->{_modules}++; | ||
51 | |||||
52 | 144 | 214µs | 144 | 764µs | my $subs = $doc->find('PPI::Statement::Sub'); # spent 764µs making 144 calls to Perl::Critic::Document::find, avg 5µs/call |
53 | 144 | 84µs | if ($subs) { | ||
54 | 144 | 138µs | foreach my $sub ( @{$subs} ) { | ||
55 | 1016 | 526µs | $self->{_subs}++; | ||
56 | 1016 | 2.22ms | 1016 | 3.97s | $self->{_subs_total_mccabe} += calculate_mccabe_of_sub( $sub ); # spent 3.97s making 1016 calls to Perl::Critic::Utils::McCabe::calculate_mccabe_of_sub, avg 3.91ms/call |
57 | } | ||||
58 | } | ||||
59 | |||||
60 | 144 | 346µs | 144 | 1.24ms | my $statements = $doc->find('PPI::Statement'); # spent 1.24ms making 144 calls to Perl::Critic::Document::find, avg 9µs/call |
61 | 144 | 140µs | $self->{_statements} += $statements ? scalar @{$statements} : 0; | ||
62 | |||||
63 | ## no critic (RequireDotMatchAnything, RequireExtendedFormatting, RequireLineBoundaryMatching) | ||||
64 | 144 | 9.41ms | 288 | 1.23s | my @lines = split /$INPUT_RECORD_SEPARATOR/, $doc->serialize(); # spent 1.23s making 144 calls to Perl::Critic::Document::AUTOLOAD, avg 8.57ms/call
# spent 397µs making 144 calls to Perl::Critic::Statistics::CORE:regcomp, avg 3µs/call |
65 | ## use critic | ||||
66 | 144 | 201µs | $self->{_lines} += scalar @lines; | ||
67 | { | ||||
68 | 288 | 119µs | my ( $in_data, $in_pod ); | ||
69 | 144 | 131µs | foreach ( @lines ) { | ||
70 | 26997 | 77.9ms | 28970 | 13.1ms | if ( q{=} eq substr $_, 0, 1 ) { ## no critic (ProhibitCascadingIfElse) # spent 13.1ms making 28970 calls to Perl::Critic::Statistics::CORE:match, avg 454ns/call |
71 | 1386 | 4.11ms | 1386 | 471µs | $in_pod = not m/ \A \s* =cut \b /smx; # spent 471µs making 1386 calls to Perl::Critic::Statistics::CORE:match, avg 340ns/call |
72 | 1386 | 312µs | $self->{_lines_of_pod}++; | ||
73 | } elsif ( $in_pod ) { | ||||
74 | $self->{_lines_of_pod}++; | ||||
75 | } elsif ( q{__END__} eq $_ || q{__DATA__} eq $_ ) { | ||||
76 | 144 | 36µs | $in_data = 1; | ||
77 | 144 | 32µs | $self->{_lines_of_perl}++; | ||
78 | } elsif ( $in_data ) { | ||||
79 | $self->{_lines_of_data}++; | ||||
80 | } elsif ( m/ \A \s* \# /smx ) { | ||||
81 | $self->{_lines_of_comment}++; | ||||
82 | } elsif ( m/ \A \s* \z /smx ) { | ||||
83 | $self->{_lines_of_blank}++; | ||||
84 | } else { | ||||
85 | 9923 | 2.17ms | $self->{_lines_of_perl}++; | ||
86 | } | ||||
87 | } | ||||
88 | } | ||||
89 | |||||
90 | 144 | 148µs | foreach my $violation ( @{ $violations } ) { | ||
91 | $self->{_violations_by_severity}->{ $violation->severity() }++; | ||||
92 | $self->{_violations_by_policy}->{ $violation->policy() }++; | ||||
93 | $self->{_total_violations}++; | ||||
94 | } | ||||
95 | |||||
96 | 144 | 3.25ms | return; | ||
97 | } | ||||
98 | |||||
99 | #----------------------------------------------------------------------------- | ||||
100 | |||||
101 | sub modules { | ||||
102 | my ( $self ) = @_; | ||||
103 | |||||
104 | return $self->{_modules}; | ||||
105 | } | ||||
106 | |||||
107 | #----------------------------------------------------------------------------- | ||||
108 | |||||
109 | sub subs { | ||||
110 | my ( $self ) = @_; | ||||
111 | |||||
112 | return $self->{_subs}; | ||||
113 | } | ||||
114 | |||||
115 | #----------------------------------------------------------------------------- | ||||
116 | |||||
117 | sub statements { | ||||
118 | my ( $self ) = @_; | ||||
119 | |||||
120 | return $self->{_statements}; | ||||
121 | } | ||||
122 | |||||
123 | #----------------------------------------------------------------------------- | ||||
124 | |||||
125 | sub lines { | ||||
126 | my ( $self ) = @_; | ||||
127 | |||||
128 | return $self->{_lines}; | ||||
129 | } | ||||
130 | |||||
131 | #----------------------------------------------------------------------------- | ||||
132 | |||||
133 | sub lines_of_blank { | ||||
134 | my ( $self ) = @_; | ||||
135 | |||||
136 | return $self->{_lines_of_blank}; | ||||
137 | } | ||||
138 | |||||
139 | #----------------------------------------------------------------------------- | ||||
140 | |||||
141 | sub lines_of_comment { | ||||
142 | my ( $self ) = @_; | ||||
143 | |||||
144 | return $self->{_lines_of_comment}; | ||||
145 | } | ||||
146 | |||||
147 | #----------------------------------------------------------------------------- | ||||
148 | |||||
149 | sub lines_of_data { | ||||
150 | my ( $self ) = @_; | ||||
151 | |||||
152 | return $self->{_lines_of_data}; | ||||
153 | } | ||||
154 | |||||
155 | #----------------------------------------------------------------------------- | ||||
156 | |||||
157 | sub lines_of_perl { | ||||
158 | my ( $self ) = @_; | ||||
159 | |||||
160 | return $self->{_lines_of_perl}; | ||||
161 | } | ||||
162 | |||||
163 | #----------------------------------------------------------------------------- | ||||
164 | |||||
165 | sub lines_of_pod { | ||||
166 | my ( $self ) = @_; | ||||
167 | |||||
168 | return $self->{_lines_of_pod}; | ||||
169 | } | ||||
170 | |||||
171 | #----------------------------------------------------------------------------- | ||||
172 | |||||
173 | sub _subs_total_mccabe { | ||||
174 | my ( $self ) = @_; | ||||
175 | |||||
176 | return $self->{_subs_total_mccabe}; | ||||
177 | } | ||||
178 | |||||
179 | #----------------------------------------------------------------------------- | ||||
180 | |||||
181 | sub violations_by_severity { | ||||
182 | my ( $self ) = @_; | ||||
183 | |||||
184 | return $self->{_violations_by_severity}; | ||||
185 | } | ||||
186 | |||||
187 | #----------------------------------------------------------------------------- | ||||
188 | |||||
189 | sub violations_by_policy { | ||||
190 | my ( $self ) = @_; | ||||
191 | |||||
192 | return $self->{_violations_by_policy}; | ||||
193 | } | ||||
194 | |||||
195 | #----------------------------------------------------------------------------- | ||||
196 | |||||
197 | sub total_violations { | ||||
198 | my ( $self ) = @_; | ||||
199 | |||||
200 | return $self->{_total_violations}; | ||||
201 | } | ||||
202 | |||||
203 | #----------------------------------------------------------------------------- | ||||
204 | |||||
205 | sub statements_other_than_subs { | ||||
206 | my ( $self ) = @_; | ||||
207 | |||||
208 | return $self->statements() - $self->subs(); | ||||
209 | } | ||||
210 | |||||
211 | #----------------------------------------------------------------------------- | ||||
212 | |||||
213 | sub average_sub_mccabe { | ||||
214 | my ( $self ) = @_; | ||||
215 | |||||
216 | return if $self->subs() == 0; | ||||
217 | |||||
218 | return $self->_subs_total_mccabe() / $self->subs(); | ||||
219 | } | ||||
220 | |||||
221 | #----------------------------------------------------------------------------- | ||||
222 | |||||
223 | sub violations_per_file { | ||||
224 | my ( $self ) = @_; | ||||
225 | |||||
226 | return if $self->modules() == 0; | ||||
227 | |||||
228 | return $self->total_violations() / $self->modules(); | ||||
229 | } | ||||
230 | |||||
231 | #----------------------------------------------------------------------------- | ||||
232 | |||||
233 | sub violations_per_statement { | ||||
234 | my ( $self ) = @_; | ||||
235 | |||||
236 | my $statements = $self->statements_other_than_subs(); | ||||
237 | |||||
238 | return if $statements == 0; | ||||
239 | |||||
240 | return $self->total_violations() / $statements; | ||||
241 | } | ||||
242 | |||||
243 | #----------------------------------------------------------------------------- | ||||
244 | |||||
245 | sub violations_per_line_of_code { | ||||
246 | my ( $self ) = @_; | ||||
247 | |||||
248 | return if $self->lines() == 0; | ||||
249 | |||||
250 | return $self->total_violations() / $self->lines(); | ||||
251 | } | ||||
252 | |||||
253 | #----------------------------------------------------------------------------- | ||||
254 | |||||
255 | 1 | 2µs | 1; | ||
256 | |||||
257 | __END__ | ||||
sub Perl::Critic::Statistics::CORE:match; # opcode | |||||
# spent 397µs within Perl::Critic::Statistics::CORE:regcomp which was called 144 times, avg 3µs/call:
# 144 times (397µs+0s) by Perl::Critic::Statistics::accumulate at line 64, avg 3µs/call |