← 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/PolicyParameter/Behavior/Enumeration.pm
StatementsExecuted 167 statements in 755┬Ás
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
811146┬Ás196┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::initialize_parameterPerl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter
51190┬Ás160┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::__ANON__[:93]Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[:93]
31142┬Ás76┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::__ANON__[:127]Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[:127]
11115┬Ás15┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@10Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@10
11112┬Ás16┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@12Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@12
1117┬Ás57┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@18Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@18
1117┬Ás290┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@16Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@16
1117┬Ás73┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@15Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@15
1117┬Ás18┬ÁsPerl::Critic::PolicyParameter::Behavior::Enumeration::::BEGIN@11Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@11
0000s0sPerl::Critic::PolicyParameter::Behavior::Enumeration::::generate_parameter_descriptionPerl::Critic::PolicyParameter::Behavior::Enumeration::generate_parameter_description
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::PolicyParameter::Behavior::Enumeration;
9
10240┬Ás115┬Ás
# spent 15┬Ás within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@10 which was called: # once (15┬Ás+0s) by Perl::Critic::PolicyParameter::BEGIN@25 at line 10
use 5.006001;
11219┬Ás230┬Ás
# spent 18┬Ás (7+11) within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@11 which was called: # once (7┬Ás+11┬Ás) by Perl::Critic::PolicyParameter::BEGIN@25 at line 11
use strict;
# spent 18┬Ás making 1 call to Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@11 # spent 12┬Ás making 1 call to strict::import
12221┬Ás219┬Ás
# spent 16┬Ás (12+4) within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@12 which was called: # once (12┬Ás+4┬Ás) by Perl::Critic::PolicyParameter::BEGIN@25 at line 12
use warnings;
# spent 16┬Ás making 1 call to Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13
14use Perl::Critic::Exception::Fatal::PolicyDefinition
15224┬Ás2139┬Ás
# spent 73┬Ás (7+66) within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@15 which was called: # once (7┬Ás+66┬Ás) by Perl::Critic::PolicyParameter::BEGIN@25 at line 15
qw{ &throw_policy_definition };
# spent 73┬Ás making 1 call to Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@15 # spent 66┬Ás making 1 call to Exporter::import
16227┬Ás2574┬Ás
# spent 290┬Ás (7+283) within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@16 which was called: # once (7┬Ás+283┬Ás) by Perl::Critic::PolicyParameter::BEGIN@25 at line 16
use Perl::Critic::Utils qw{ :characters &words_from_string &hashify };
# spent 290┬Ás making 1 call to Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@16 # spent 283┬Ás making 1 call to Exporter::import
17
182421┬Ás257┬Ás
# spent 57┬Ás (7+50) within Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@18 which was called: # once (7┬Ás+50┬Ás) by Perl::Critic::PolicyParameter::BEGIN@25 at line 18
use base qw{ Perl::Critic::PolicyParameter::Behavior };
# spent 57┬Ás making 1 call to Perl::Critic::PolicyParameter::Behavior::Enumeration::BEGIN@18 # spent 50┬Ás making 1 call to base::import, recursion: max depth 1, sum of overlapping time 50┬Ás
19
201600nsour $VERSION = '1.121';
21
22#-----------------------------------------------------------------------------
23
24
# spent 196┬Ás (146+50) within Perl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter which was called 8 times, avg 24┬Ás/call: # 8 times (146┬Ás+50┬Ás) by Perl::Critic::PolicyParameter::_initialize_from_behavior at line 115 of Perl/Critic/PolicyParameter.pm, avg 24┬Ás/call
sub initialize_parameter {
2582┬Ás my ($self, $parameter, $specification) = @_;
26
2783┬Ás my $valid_values = $specification->{enumeration_values}
28 or throw_policy_definition
29 'No enumeration_values given for '
30 . $parameter->get_name()
31 . $PERIOD;
3284┬Ás ref $valid_values eq 'ARRAY'
33 or throw_policy_definition
34 'The value given for enumeration_values for '
35 . $parameter->get_name()
36 . ' is not an array reference.';
3783┬Ás scalar @{$valid_values} > 1
38 or throw_policy_definition
39 'There were not at least two valid values given for'
40 . ' enumeration_values for '
41 . $parameter->get_name()
42 . $PERIOD;
43
44 # Unfortunately, this has to be a reference, rather than a regular hash,
45 # due to a problem in Devel::Cycle
46 # (http://rt.cpan.org/Ticket/Display.html?id=25360) which causes
47 # t/92_memory_leaks.t to fall over.
48833┬Ás826┬Ás my $value_lookup = { hashify( @{$valid_values} ) };
# spent 26┬Ás making 8 calls to Perl::Critic::Utils::hashify, avg 3┬Ás/call
49814┬Ás810┬Ás $parameter->_get_behavior_values()->{enumeration_values} = $value_lookup;
# spent 10┬Ás making 8 calls to Perl::Critic::PolicyParameter::_get_behavior_values, avg 1┬Ás/call
50
5183┬Ás my $allow_multiple_values =
52 $specification->{enumeration_allow_multiple_values};
53
5483┬Ás if ($allow_multiple_values) {
55 $parameter->_set_parser(
56
# spent 160┬Ás (90+70) within Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:93] which was called 5 times, avg 32┬Ás/call: # 5 times (90┬Ás+70┬Ás) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm, avg 32┬Ás/call
sub {
57 # Normally bad thing, obscuring a variable in a outer scope
58 # with a variable with the same name is being done here in
59 # order to remain consistent with the parser function interface.
6051┬Ás my ($policy, $parameter, $config_string) = @_; ## no critic(Variables::ProhibitReusedNames)
61
625500ns my @potential_values;
6356┬Ás56┬Ás my $value_string = $parameter->get_default_string();
# spent 6┬Ás making 5 calls to Perl::Critic::PolicyParameter::get_default_string, avg 1┬Ás/call
64
655800ns if (defined $config_string) {
66 $value_string = $config_string;
67 }
68
6952┬Ás if ( defined $value_string ) {
7058┬Ás510┬Ás @potential_values = words_from_string($value_string);
# spent 10┬Ás making 5 calls to Perl::Critic::Utils::words_from_string, avg 2┬Ás/call
71
72 my @bad_values =
7355┬Ás grep { not exists $value_lookup->{$_} } @potential_values;
7452┬Ás if (@bad_values) {
75 $policy->throw_parameter_value_exception(
76 $parameter->get_name(),
77 $value_string,
78 undef,
79 q{contains invalid values: }
80 . join (q{, }, @bad_values)
81 . q{. Allowed values are: }
82 . join (q{, }, sort keys %{$value_lookup})
83 . qq{.\n},
84 );
85 }
86 }
87
8859┬Ás57┬Ás my %actual_values = hashify(@potential_values);
# spent 7┬Ás making 5 calls to Perl::Critic::Utils::hashify, avg 1┬Ás/call
89
90514┬Ás546┬Ás $policy->__set_parameter_value($parameter, \%actual_values);
# spent 46┬Ás making 5 calls to Perl::Critic::Policy::__set_parameter_value, avg 9┬Ás/call
91
92513┬Ás return;
93 }
94518┬Ás58┬Ás );
# spent 8┬Ás making 5 calls to Perl::Critic::PolicyParameter::_set_parser, avg 2┬Ás/call
95 } else {
96 $parameter->_set_parser(
97
# spent 76┬Ás (42+34) within Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:127] which was called 3 times, avg 25┬Ás/call: # 3 times (42┬Ás+34┬Ás) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm, avg 25┬Ás/call
sub {
98 # Normally bad thing, obscuring a variable in a outer scope
99 # with a variable with the same name is being done here in
100 # order to remain consistent with the parser function interface.
1013900ns my ($policy, $parameter, $config_string) = @_; ## no critic(Variables::ProhibitReusedNames)
102
10334┬Ás34┬Ás my $value_string = $parameter->get_default_string();
# spent 4┬Ás making 3 calls to Perl::Critic::PolicyParameter::get_default_string, avg 1┬Ás/call
104
1053600ns if (defined $config_string) {
106 $value_string = $config_string;
107 }
108
10938┬Ás34┬Ás if (
# spent 4┬Ás making 3 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
110 defined $value_string
111 and $EMPTY ne $value_string
112 and not defined $value_lookup->{$value_string}
113 ) {
114 $policy->throw_parameter_value_exception(
115 $parameter->get_name(),
116 $value_string,
117 undef,
118 q{is not one of the allowed values: }
119 . join (q{, }, sort keys %{$value_lookup})
120 . qq{.\n},
121 );
122 }
123
12436┬Ás327┬Ás $policy->__set_parameter_value($parameter, $value_string);
# spent 27┬Ás making 3 calls to Perl::Critic::Policy::__set_parameter_value, avg 9┬Ás/call
125
12638┬Ás return;
127 }
128312┬Ás35┬Ás );
# spent 5┬Ás making 3 calls to Perl::Critic::PolicyParameter::_set_parser, avg 2┬Ás/call
129 }
130
131819┬Ás return;
132}
133
134#-----------------------------------------------------------------------------
135
136sub generate_parameter_description {
137 my ($self, $parameter) = @_;
138
139 my $description = $parameter->_get_description_with_trailing_period();
140 if ( $description ) {
141 $description .= qq{\n};
142 }
143
144 my %values = %{$parameter->_get_behavior_values()->{enumeration_values}};
145 return
146 $description
147 . 'Valid values: '
148 . join (', ', sort keys %values)
149 . $PERIOD;
150}
151
152#-----------------------------------------------------------------------------
153
15412┬Ás1;
155
156__END__