← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:14 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Statistics.pm
StatementsExecuted 44055 statements in 103ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1441194.7ms5.32sPerl::Critic::Statistics::::accumulatePerl::Critic::Statistics::accumulate
303562113.6ms13.6msPerl::Critic::Statistics::::CORE:matchPerl::Critic::Statistics::CORE:match (opcode)
14411397µs397µsPerl::Critic::Statistics::::CORE:regcompPerl::Critic::Statistics::CORE:regcomp (opcode)
11117µs17µsPerl::Critic::Statistics::::newPerl::Critic::Statistics::new
11115µs15µsPerl::Critic::Statistics::::BEGIN@10Perl::Critic::Statistics::BEGIN@10
11111µs32µsPerl::Critic::Statistics::::BEGIN@16Perl::Critic::Statistics::BEGIN@16
1119µs410µsPerl::Critic::Statistics::::BEGIN@14Perl::Critic::Statistics::BEGIN@14
1118µs13µsPerl::Critic::Statistics::::BEGIN@12Perl::Critic::Statistics::BEGIN@12
1117µs19µsPerl::Critic::Statistics::::BEGIN@11Perl::Critic::Statistics::BEGIN@11
0000s0sPerl::Critic::Statistics::::_subs_total_mccabePerl::Critic::Statistics::_subs_total_mccabe
0000s0sPerl::Critic::Statistics::::average_sub_mccabePerl::Critic::Statistics::average_sub_mccabe
0000s0sPerl::Critic::Statistics::::linesPerl::Critic::Statistics::lines
0000s0sPerl::Critic::Statistics::::lines_of_blankPerl::Critic::Statistics::lines_of_blank
0000s0sPerl::Critic::Statistics::::lines_of_commentPerl::Critic::Statistics::lines_of_comment
0000s0sPerl::Critic::Statistics::::lines_of_dataPerl::Critic::Statistics::lines_of_data
0000s0sPerl::Critic::Statistics::::lines_of_perlPerl::Critic::Statistics::lines_of_perl
0000s0sPerl::Critic::Statistics::::lines_of_podPerl::Critic::Statistics::lines_of_pod
0000s0sPerl::Critic::Statistics::::modulesPerl::Critic::Statistics::modules
0000s0sPerl::Critic::Statistics::::statementsPerl::Critic::Statistics::statements
0000s0sPerl::Critic::Statistics::::statements_other_than_subsPerl::Critic::Statistics::statements_other_than_subs
0000s0sPerl::Critic::Statistics::::subsPerl::Critic::Statistics::subs
0000s0sPerl::Critic::Statistics::::total_violationsPerl::Critic::Statistics::total_violations
0000s0sPerl::Critic::Statistics::::violations_by_policyPerl::Critic::Statistics::violations_by_policy
0000s0sPerl::Critic::Statistics::::violations_by_severityPerl::Critic::Statistics::violations_by_severity
0000s0sPerl::Critic::Statistics::::violations_per_filePerl::Critic::Statistics::violations_per_file
0000s0sPerl::Critic::Statistics::::violations_per_line_of_codePerl::Critic::Statistics::violations_per_line_of_code
0000s0sPerl::Critic::Statistics::::violations_per_statementPerl::Critic::Statistics::violations_per_statement
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8package Perl::Critic::Statistics;
9
10239µs115µ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
use 5.006001;
# spent 15µs making 1 call to Perl::Critic::Statistics::BEGIN@10
11223µs231µ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
use strict;
# spent 19µs making 1 call to Perl::Critic::Statistics::BEGIN@11 # spent 12µs making 1 call to strict::import
12221µs218µ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
use warnings;
# spent 13µs making 1 call to Perl::Critic::Statistics::BEGIN@12 # spent 5µs making 1 call to warnings::import
13
14226µs2811µ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
use English qw(-no_match_vars);
# spent 410µs making 1 call to Perl::Critic::Statistics::BEGIN@14 # spent 401µs making 1 call to English::import
15
162762µs254µ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
use Perl::Critic::Utils::McCabe qw{ calculate_mccabe_of_sub };
# spent 32µs making 1 call to Perl::Critic::Statistics::BEGIN@16 # spent 22µs making 1 call to Exporter::import
17
18#-----------------------------------------------------------------------------
19
201600nsour $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
sub new {
251700ns my ( $class ) = @_;
26
2713µs my $self = bless {}, $class;
28
2912µs $self->{_modules} = 0;
301500ns $self->{_subs} = 0;
311800ns $self->{_statements} = 0;
321700ns $self->{_lines} = 0;
331600ns $self->{_lines_of_blank} = 0;
341800ns $self->{_lines_of_comment} = 0;
351800ns $self->{_lines_of_data} = 0;
361900ns $self->{_lines_of_perl} = 0;
371500ns $self->{_lines_of_pod} = 0;
381400ns $self->{_violations_by_policy} = {};
391300ns $self->{_violations_by_severity} = {};
401700ns $self->{_total_violations} = 0;
41
4214µ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
sub accumulate {
4814474µs my ($self, $doc, $violations) = @_;
49
5014487µs $self->{_modules}++;
51
52144214µs144764µs my $subs = $doc->find('PPI::Statement::Sub');
# spent 764µs making 144 calls to Perl::Critic::Document::find, avg 5µs/call
5314484µs if ($subs) {
54144138µs foreach my $sub ( @{$subs} ) {
551016526µs $self->{_subs}++;
5610162.22ms10163.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
60144346µs1441.24ms my $statements = $doc->find('PPI::Statement');
# spent 1.24ms making 144 calls to Perl::Critic::Document::find, avg 9µs/call
61144140µs $self->{_statements} += $statements ? scalar @{$statements} : 0;
62
63 ## no critic (RequireDotMatchAnything, RequireExtendedFormatting, RequireLineBoundaryMatching)
641449.41ms2881.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
66144201µs $self->{_lines} += scalar @lines;
67 {
68288119µs my ( $in_data, $in_pod );
69144131µs foreach ( @lines ) {
702699777.9ms2897013.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
7113864.11ms1386471µ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
721386312µs $self->{_lines_of_pod}++;
73 } elsif ( $in_pod ) {
74 $self->{_lines_of_pod}++;
75 } elsif ( q{__END__} eq $_ || q{__DATA__} eq $_ ) {
7614436µs $in_data = 1;
7714432µ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 {
8599232.17ms $self->{_lines_of_perl}++;
86 }
87 }
88 }
89
90144148µ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
961443.25ms return;
97}
98
99#-----------------------------------------------------------------------------
100
101sub modules {
102 my ( $self ) = @_;
103
104 return $self->{_modules};
105}
106
107#-----------------------------------------------------------------------------
108
109sub subs {
110 my ( $self ) = @_;
111
112 return $self->{_subs};
113}
114
115#-----------------------------------------------------------------------------
116
117sub statements {
118 my ( $self ) = @_;
119
120 return $self->{_statements};
121}
122
123#-----------------------------------------------------------------------------
124
125sub lines {
126 my ( $self ) = @_;
127
128 return $self->{_lines};
129}
130
131#-----------------------------------------------------------------------------
132
133sub lines_of_blank {
134 my ( $self ) = @_;
135
136 return $self->{_lines_of_blank};
137}
138
139#-----------------------------------------------------------------------------
140
141sub lines_of_comment {
142 my ( $self ) = @_;
143
144 return $self->{_lines_of_comment};
145}
146
147#-----------------------------------------------------------------------------
148
149sub lines_of_data {
150 my ( $self ) = @_;
151
152 return $self->{_lines_of_data};
153}
154
155#-----------------------------------------------------------------------------
156
157sub lines_of_perl {
158 my ( $self ) = @_;
159
160 return $self->{_lines_of_perl};
161}
162
163#-----------------------------------------------------------------------------
164
165sub lines_of_pod {
166 my ( $self ) = @_;
167
168 return $self->{_lines_of_pod};
169}
170
171#-----------------------------------------------------------------------------
172
173sub _subs_total_mccabe {
174 my ( $self ) = @_;
175
176 return $self->{_subs_total_mccabe};
177}
178
179#-----------------------------------------------------------------------------
180
181sub violations_by_severity {
182 my ( $self ) = @_;
183
184 return $self->{_violations_by_severity};
185}
186
187#-----------------------------------------------------------------------------
188
189sub violations_by_policy {
190 my ( $self ) = @_;
191
192 return $self->{_violations_by_policy};
193}
194
195#-----------------------------------------------------------------------------
196
197sub total_violations {
198 my ( $self ) = @_;
199
200 return $self->{_total_violations};
201}
202
203#-----------------------------------------------------------------------------
204
205sub statements_other_than_subs {
206 my ( $self ) = @_;
207
208 return $self->statements() - $self->subs();
209}
210
211#-----------------------------------------------------------------------------
212
213sub 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
223sub 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
233sub 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
245sub 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
25512µs1;
256
257__END__
 
# spent 13.6ms within Perl::Critic::Statistics::CORE:match which was called 30356 times, avg 449ns/call: # 28970 times (13.1ms+0s) by Perl::Critic::Statistics::accumulate at line 70, avg 454ns/call # 1386 times (471µs+0s) by Perl::Critic::Statistics::accumulate at line 71, avg 340ns/call
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
sub Perl::Critic::Statistics::CORE:regcomp; # opcode