← 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:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm
StatementsExecuted 29676 statements in 57.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
121641143.8ms97.6msPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::_is_conditionalPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::_is_conditional
12991113.6ms277msPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::violatesPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::violates
14411283µs283µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::applies_toPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::applies_to
11117µs17µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@10Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@10
11112µs69µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@16Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@16
1118µs12µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@12Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@12
1117µs466µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@15Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@15
1117µs29µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@13Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@13
1117µs18µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::BEGIN@11Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@11
1116µs7µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::default_severityPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::default_severity
1112µs2µsPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::supported_parametersPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::supported_parameters
0000s0sPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::::default_themesPerl::Critic::Policy::Variables::ProhibitConditionalDeclarations::default_themes
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::Policy::Variables::ProhibitConditionalDeclarations;
9
10239µs117µs
# spent 17µs within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@10 which was called: # once (17µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11224µs230µs
# spent 18µs (7+11) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@11 # spent 11µs making 1 call to strict::import
12219µs215µs
# spent 12µs (8+4) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 12µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@12 # spent 4µs making 1 call to warnings::import
13227µs251µs
# spent 29µs (7+22) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@13 which was called: # once (7µs+22µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 29µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14
15225µs2924µs
# spent 466µs (7+458) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@15 which was called: # once (7µs+458µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities :classification :data_conversion };
# spent 466µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@15 # spent 458µs making 1 call to Exporter::import
162212µs2126µs
# spent 69µs (12+57) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@16 which was called: # once (12µs+57µs) by Module::Pluggable::Object::_require at line 16
use base 'Perl::Critic::Policy';
# spent 69µs making 1 call to Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::BEGIN@16 # spent 57µs making 1 call to base::import
17
181700nsour $VERSION = '1.121';
19
20#-----------------------------------------------------------------------------
21
2212µs130µsReadonly::Scalar my $DESC => q{Variable declared in conditional statement};
# spent 30µs making 1 call to Readonly::Scalar
2311µs122µsReadonly::Scalar my $EXPL => q{Declare variables outside of the condition};
# spent 22µs making 1 call to Readonly::Scalar
24
25#-----------------------------------------------------------------------------
26
2718µs
# spent 2µs within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::supported_parameters which was called: # once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters { return () }
2812µs
# spent 7µs (6+1) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::default_severity which was called: # once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_HIGHEST }
29sub default_themes { return qw( core bugs ) }
30144387µs
# spent 283µs within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::applies_to which was called 144 times, avg 2µs/call: # 144 times (283µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call
sub applies_to { return 'PPI::Statement::Variable' }
31
32#-----------------------------------------------------------------------------
33
34
# spent 277ms (13.6+263) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::violates which was called 1299 times, avg 213µs/call: # 1299 times (13.6ms+263ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 213µs/call
sub violates {
351299397µs my ( $self, $elem, undef ) = @_;
3612991.73ms129997.6ms return if $elem->type() eq 'local';
# spent 97.6ms making 1299 calls to PPI::Statement::Variable::type, avg 75µs/call
37
3812931.96ms1293165ms if ( $elem->find(\&_is_conditional) ) {
# spent 165ms making 1293 calls to PPI::Node::find, avg 128µs/call
39 return $self->violation( $DESC, $EXPL, $elem );
40 }
4112934.61ms return; #ok!
42}
43
4412µsmy @conditionals = qw( if while foreach for until unless );
4514µs14µsmy %conditionals = hashify( @conditionals );
# spent 4µs making 1 call to Perl::Critic::Utils::hashify
46
47
# spent 97.6ms (43.8+53.8) within Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::_is_conditional which was called 12164 times, avg 8µs/call: # 12164 times (43.8ms+53.8ms) by PPI::Node::find at line 381 of PPI/Node.pm, avg 8µs/call
sub _is_conditional {
48121642.95ms my (undef, $elem) = @_;
49
501216444.9ms1216453.8ms return if !$conditionals{$elem};
# spent 39.1ms making 945 calls to PPI::Structure::content, avg 41µs/call # spent 14.7ms making 11219 calls to PPI::Token::content, avg 1µs/call
51 return if ! $elem->isa('PPI::Token::Word');
52 return if is_hash_key($elem);
53 return if is_method_call($elem);
54
55 return 1;
56}
57
5816µs1;
59
60__END__