Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyConfig.pm |
Statements | Executed 8306 statements in 20.3ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
141 | 1 | 1 | 8.11ms | 101ms | handle_extra_parameters | Perl::Critic::PolicyConfig::
282 | 2 | 2 | 3.88ms | 4.59ms | new | Perl::Critic::PolicyConfig::
564 | 4 | 1 | 2.21ms | 2.82ms | _get_non_public_data | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 922µs | 2.40ms | is_maximum_violations_per_document_unlimited | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 900µs | 1.10ms | get_parameter_names | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 664µs | 816µs | set_profile_strictness | Perl::Critic::PolicyConfig::
97 | 1 | 1 | 496µs | 614µs | remove | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 461µs | 1.49ms | BEGIN@20 | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 453µs | 1.28ms | get_maximum_violations_per_document | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 429µs | 1.99ms | BEGIN@19 | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 426µs | 1.12ms | get_severity | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 418µs | 1.07ms | get_set_themes | Perl::Critic::PolicyConfig::
141 | 1 | 1 | 400µs | 1.03ms | get_add_themes | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 15µs | 15µs | BEGIN@10 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 13µs | 176µs | BEGIN@22 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 11µs | 489µs | BEGIN@21 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 7µs | 11µs | BEGIN@12 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 7µs | 22µs | BEGIN@18 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 7µs | 26µs | BEGIN@14 | Perl::Critic::PolicyConfig::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::PolicyConfig::
0 | 0 | 0 | 0s | 0s | get | Perl::Critic::PolicyConfig::
0 | 0 | 0 | 0s | 0s | get_policy_short_name | Perl::Critic::PolicyConfig::
0 | 0 | 0 | 0s | 0s | is_empty | Perl::Critic::PolicyConfig::
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::PolicyConfig; | ||||
9 | |||||
10 | 2 | 37µs | 1 | 15µs | # spent 15µs within Perl::Critic::PolicyConfig::BEGIN@10 which was called:
# once (15µs+0s) by Perl::Critic::PolicyFactory::BEGIN@27 at line 10 # spent 15µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@10 |
11 | 2 | 22µs | 2 | 29µs | # spent 18µs (7+11) within Perl::Critic::PolicyConfig::BEGIN@11 which was called:
# once (7µs+11µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 11 # spent 18µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 18µs | 2 | 15µs | # spent 11µs (7+4) within Perl::Critic::PolicyConfig::BEGIN@12 which was called:
# once (7µs+4µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 12 # spent 11µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 27µs | 2 | 46µs | # spent 26µs (7+20) within Perl::Critic::PolicyConfig::BEGIN@14 which was called:
# once (7µs+20µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 14 # spent 26µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@14
# spent 20µs making 1 call to Exporter::import |
15 | |||||
16 | 1 | 900ns | our $VERSION = '1.121'; | ||
17 | |||||
18 | 2 | 19µs | 2 | 38µs | # spent 22µs (7+15) within Perl::Critic::PolicyConfig::BEGIN@18 which was called:
# once (7µs+15µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 18 # spent 22µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@18
# spent 15µs making 1 call to Exporter::import |
19 | 2 | 120µs | 2 | 2.02ms | # spent 1.99ms (429µs+1.56) within Perl::Critic::PolicyConfig::BEGIN@19 which was called:
# once (429µs+1.56ms) by Perl::Critic::PolicyFactory::BEGIN@27 at line 19 # spent 1.99ms making 1 call to Perl::Critic::PolicyConfig::BEGIN@19
# spent 24µs making 1 call to Exporter::import |
20 | 2 | 167µs | 2 | 1.51ms | # spent 1.49ms (461µs+1.03) within Perl::Critic::PolicyConfig::BEGIN@20 which was called:
# once (461µs+1.03ms) by Perl::Critic::PolicyFactory::BEGIN@27 at line 20 # spent 1.49ms making 1 call to Perl::Critic::PolicyConfig::BEGIN@20
# spent 24µs making 1 call to Exporter::import |
21 | 2 | 39µs | 2 | 967µs | # spent 489µs (11+478) within Perl::Critic::PolicyConfig::BEGIN@21 which was called:
# once (11µs+478µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 21 # spent 489µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@21
# spent 478µs making 1 call to Exporter::import |
22 | 2 | 870µs | 2 | 339µs | # spent 176µs (13+163) within Perl::Critic::PolicyConfig::BEGIN@22 which was called:
# once (13µs+163µs) by Perl::Critic::PolicyFactory::BEGIN@27 at line 22 # spent 176µs making 1 call to Perl::Critic::PolicyConfig::BEGIN@22
# spent 163µs making 1 call to Exporter::import |
23 | |||||
24 | #----------------------------------------------------------------------------- | ||||
25 | |||||
26 | 1 | 3µs | 1 | 45µs | Readonly::Scalar my $NON_PUBLIC_DATA => '_non_public_data'; # spent 45µs making 1 call to Readonly::Scalar |
27 | 1 | 1µs | 1 | 30µs | Readonly::Scalar my $NO_LIMIT => 'no_limit'; # spent 30µs making 1 call to Readonly::Scalar |
28 | |||||
29 | #----------------------------------------------------------------------------- | ||||
30 | |||||
31 | # spent 4.59ms (3.88+704µs) within Perl::Critic::PolicyConfig::new which was called 282 times, avg 16µs/call:
# 141 times (2.03ms+340µs) by Perl::Critic::UserProfile::policy_params at line 66 of Perl/Critic/UserProfile.pm, avg 17µs/call
# 141 times (1.85ms+364µs) by Perl::Critic::Policy::new at line 72 of Perl/Critic/Policy.pm, avg 16µs/call | ||||
32 | 282 | 103µs | my ($class, $policy_short_name, $specification) = @_; | ||
33 | |||||
34 | 282 | 267µs | my %self = $specification ? %{ $specification } : (); | ||
35 | 282 | 30µs | my %non_public_data; | ||
36 | |||||
37 | 282 | 170µs | $non_public_data{_policy_short_name} = $policy_short_name; | ||
38 | 282 | 701µs | 282 | 353µs | $non_public_data{_profile_strictness} = # spent 353µs making 282 calls to Readonly::Scalar::FETCH, avg 1µs/call |
39 | $self{$NON_PUBLIC_DATA}{_profile_strictness}; | ||||
40 | |||||
41 | 282 | 154µs | foreach my $standard_parameter ( | ||
42 | qw< maximum_violations_per_document severity set_themes add_themes > | ||||
43 | ) { | ||||
44 | 1128 | 343µs | if ( exists $self{$standard_parameter} ) { | ||
45 | $non_public_data{"_$standard_parameter"} = | ||||
46 | delete $self{$standard_parameter}; | ||||
47 | } | ||||
48 | } | ||||
49 | |||||
50 | 282 | 615µs | 282 | 351µs | $self{$NON_PUBLIC_DATA} = \%non_public_data; # spent 351µs making 282 calls to Readonly::Scalar::FETCH, avg 1µs/call |
51 | |||||
52 | |||||
53 | 282 | 744µs | return bless \%self, $class; | ||
54 | } | ||||
55 | |||||
56 | #----------------------------------------------------------------------------- | ||||
57 | |||||
58 | # spent 2.82ms (2.21+606µs) within Perl::Critic::PolicyConfig::_get_non_public_data which was called 564 times, avg 5µs/call:
# 141 times (654µs+178µs) by Perl::Critic::PolicyConfig::get_maximum_violations_per_document at line 118, avg 6µs/call
# 141 times (550µs+146µs) by Perl::Critic::PolicyConfig::get_severity at line 93, avg 5µs/call
# 141 times (513µs+144µs) by Perl::Critic::PolicyConfig::get_set_themes at line 77, avg 5µs/call
# 141 times (495µs+139µs) by Perl::Critic::PolicyConfig::get_add_themes at line 85, avg 4µs/call | ||||
59 | 564 | 72µs | my $self = shift; | ||
60 | |||||
61 | 564 | 1.90ms | 564 | 606µs | return $self->{$NON_PUBLIC_DATA}; # spent 606µs making 564 calls to Readonly::Scalar::FETCH, avg 1µs/call |
62 | } | ||||
63 | |||||
64 | #----------------------------------------------------------------------------- | ||||
65 | |||||
66 | sub get_policy_short_name { | ||||
67 | my $self = shift; | ||||
68 | |||||
69 | return $self->_get_non_public_data()->{_policy_short_name}; | ||||
70 | } | ||||
71 | |||||
72 | #----------------------------------------------------------------------------- | ||||
73 | |||||
74 | # spent 1.07ms (418µs+657µs) within Perl::Critic::PolicyConfig::get_set_themes which was called 141 times, avg 8µs/call:
# 141 times (418µs+657µs) by Perl::Critic::Policy::__set_base_parameters at line 169 of Perl/Critic/Policy.pm, avg 8µs/call | ||||
75 | 141 | 17µs | my ($self) = @_; | ||
76 | |||||
77 | 141 | 323µs | 141 | 657µs | return $self->_get_non_public_data()->{_set_themes}; # spent 657µs making 141 calls to Perl::Critic::PolicyConfig::_get_non_public_data, avg 5µs/call |
78 | } | ||||
79 | |||||
80 | #----------------------------------------------------------------------------- | ||||
81 | |||||
82 | # spent 1.03ms (400µs+634µs) within Perl::Critic::PolicyConfig::get_add_themes which was called 141 times, avg 7µs/call:
# 141 times (400µs+634µs) by Perl::Critic::Policy::__set_base_parameters at line 175 of Perl/Critic/Policy.pm, avg 7µs/call | ||||
83 | 141 | 17µs | my ($self) = @_; | ||
84 | |||||
85 | 141 | 3.47ms | 141 | 634µs | return $self->_get_non_public_data()->{_add_themes}; # spent 634µs making 141 calls to Perl::Critic::PolicyConfig::_get_non_public_data, avg 4µs/call |
86 | } | ||||
87 | |||||
88 | #----------------------------------------------------------------------------- | ||||
89 | |||||
90 | # spent 1.12ms (426µs+696µs) within Perl::Critic::PolicyConfig::get_severity which was called 141 times, avg 8µs/call:
# 141 times (426µs+696µs) by Perl::Critic::Policy::__set_base_parameters at line 163 of Perl/Critic/Policy.pm, avg 8µs/call | ||||
91 | 141 | 23µs | my ($self) = @_; | ||
92 | |||||
93 | 141 | 330µs | 141 | 696µs | return $self->_get_non_public_data()->{_severity}; # spent 696µs making 141 calls to Perl::Critic::PolicyConfig::_get_non_public_data, avg 5µs/call |
94 | } | ||||
95 | |||||
96 | #----------------------------------------------------------------------------- | ||||
97 | |||||
98 | # spent 2.40ms (922µs+1.48) within Perl::Critic::PolicyConfig::is_maximum_violations_per_document_unlimited which was called 141 times, avg 17µs/call:
# 141 times (922µs+1.48ms) by Perl::Critic::Policy::_set_maximum_violations_per_document at line 195 of Perl/Critic/Policy.pm, avg 17µs/call | ||||
99 | 141 | 17µs | my ($self) = @_; | ||
100 | |||||
101 | 141 | 173µs | 141 | 1.28ms | my $maximum_violations = $self->get_maximum_violations_per_document(); # spent 1.28ms making 141 calls to Perl::Critic::PolicyConfig::get_maximum_violations_per_document, avg 9µs/call |
102 | 141 | 269µs | if ( | ||
103 | not defined $maximum_violations | ||||
104 | or $maximum_violations eq $EMPTY | ||||
105 | or $maximum_violations =~ m<\A $NO_LIMIT \z>xmsio | ||||
106 | ) { | ||||
107 | return $TRUE; | ||||
108 | } | ||||
109 | |||||
110 | return $FALSE; | ||||
111 | } | ||||
112 | |||||
113 | #----------------------------------------------------------------------------- | ||||
114 | |||||
115 | # spent 1.28ms (453µs+832µs) within Perl::Critic::PolicyConfig::get_maximum_violations_per_document which was called 141 times, avg 9µs/call:
# 141 times (453µs+832µs) by Perl::Critic::PolicyConfig::is_maximum_violations_per_document_unlimited at line 101, avg 9µs/call | ||||
116 | 141 | 16µs | my ($self) = @_; | ||
117 | |||||
118 | 141 | 369µs | 141 | 832µs | return $self->_get_non_public_data()->{_maximum_violations_per_document}; # spent 832µs making 141 calls to Perl::Critic::PolicyConfig::_get_non_public_data, avg 6µs/call |
119 | } | ||||
120 | |||||
121 | #----------------------------------------------------------------------------- | ||||
122 | |||||
123 | sub get { | ||||
124 | my ($self, $parameter) = @_; | ||||
125 | |||||
126 | return if $parameter eq $NON_PUBLIC_DATA; | ||||
127 | |||||
128 | return $self->{$parameter}; | ||||
129 | } | ||||
130 | |||||
131 | #----------------------------------------------------------------------------- | ||||
132 | |||||
133 | # spent 614µs (496+117) within Perl::Critic::PolicyConfig::remove which was called 97 times, avg 6µs/call:
# 97 times (496µs+117µs) by Perl::Critic::Policy::new at line 103 of Perl/Critic/Policy.pm, avg 6µs/call | ||||
134 | 97 | 25µs | my ($self, $parameter) = @_; | ||
135 | |||||
136 | 97 | 209µs | 97 | 117µs | return if $parameter eq $NON_PUBLIC_DATA; # spent 117µs making 97 calls to Readonly::Scalar::FETCH, avg 1µs/call |
137 | |||||
138 | 97 | 29µs | delete $self->{$parameter}; | ||
139 | |||||
140 | 97 | 151µs | return; | ||
141 | } | ||||
142 | |||||
143 | #----------------------------------------------------------------------------- | ||||
144 | |||||
145 | sub is_empty { | ||||
146 | my ($self) = @_; | ||||
147 | |||||
148 | return 1 >= keys %{$self}; | ||||
149 | } | ||||
150 | |||||
151 | #----------------------------------------------------------------------------- | ||||
152 | |||||
153 | # spent 1.10ms (900µs+203µs) within Perl::Critic::PolicyConfig::get_parameter_names which was called 141 times, avg 8µs/call:
# 141 times (900µs+203µs) by Perl::Critic::PolicyConfig::handle_extra_parameters at line 173, avg 8µs/call | ||||
154 | 141 | 30µs | my ($self) = @_; | ||
155 | |||||
156 | 141 | 765µs | 141 | 203µs | return grep { $_ ne $NON_PUBLIC_DATA } keys %{$self}; # spent 203µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
157 | } | ||||
158 | |||||
159 | #----------------------------------------------------------------------------- | ||||
160 | |||||
161 | # spent 101ms (8.11+92.9) within Perl::Critic::PolicyConfig::handle_extra_parameters which was called 141 times, avg 716µs/call:
# 141 times (8.11ms+92.9ms) by Perl::Critic::Policy::new at line 106 of Perl/Critic/Policy.pm, avg 716µs/call | ||||
162 | 141 | 36µs | my ($self, $policy, $errors) = @_; | ||
163 | |||||
164 | 141 | 363µs | 141 | 176µs | my $profile_strictness = $self->{$NON_PUBLIC_DATA}{_profile_strictness}; # spent 176µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
165 | 141 | 22µs | defined $profile_strictness | ||
166 | or $profile_strictness = $PROFILE_STRICTNESS_DEFAULT; | ||||
167 | |||||
168 | 141 | 274µs | 141 | 169µs | return if $profile_strictness eq $PROFILE_STRICTNESS_QUIET; # spent 169µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
169 | |||||
170 | 141 | 454µs | 282 | 90.6ms | my $parameter_errors = $profile_strictness eq $PROFILE_STRICTNESS_WARN ? # spent 90.5ms making 141 calls to Perl::Critic::Exception::AggregateConfiguration::new, avg 642µs/call
# spent 160µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
171 | Perl::Critic::Exception::AggregateConfiguration->new() : $errors; | ||||
172 | |||||
173 | 141 | 339µs | 141 | 1.10ms | foreach my $offered_param ( $self->get_parameter_names() ) { # spent 1.10ms making 141 calls to Perl::Critic::PolicyConfig::get_parameter_names, avg 8µs/call |
174 | $parameter_errors->add_exception( | ||||
175 | Perl::Critic::Exception::Configuration::Option::Policy::ExtraParameter->new( | ||||
176 | policy => $policy->get_short_name(), | ||||
177 | option_name => $offered_param, | ||||
178 | source => undef, | ||||
179 | ) | ||||
180 | ); | ||||
181 | } | ||||
182 | |||||
183 | 141 | 424µs | 282 | 847µs | warn qq<$parameter_errors\n> # spent 673µs making 141 calls to Perl::Critic::Exception::AggregateConfiguration::has_exceptions, avg 5µs/call
# spent 173µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
184 | if ($profile_strictness eq $PROFILE_STRICTNESS_WARN | ||||
185 | && $parameter_errors->has_exceptions()); | ||||
186 | |||||
187 | 141 | 5.13ms | return; | ||
188 | } | ||||
189 | |||||
190 | #----------------------------------------------------------------------------- | ||||
191 | |||||
192 | # spent 816µs (664+152) within Perl::Critic::PolicyConfig::set_profile_strictness which was called 141 times, avg 6µs/call:
# 141 times (664µs+152µs) by Perl::Critic::PolicyFactory::_instantiate_policy at line 258 of Perl/Critic/PolicyFactory.pm, avg 6µs/call | ||||
193 | 141 | 30µs | my ($self, $profile_strictness) = @_; | ||
194 | |||||
195 | 141 | 302µs | 141 | 152µs | $self->{$NON_PUBLIC_DATA}{_profile_strictness} = $profile_strictness; # spent 152µs making 141 calls to Readonly::Scalar::FETCH, avg 1µs/call |
196 | |||||
197 | 141 | 244µs | return; | ||
198 | } | ||||
199 | |||||
200 | #----------------------------------------------------------------------------- | ||||
201 | |||||
202 | 1 | 5µs | 1; | ||
203 | |||||
204 | __END__ |