← 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/Integer.pm
StatementsExecuted 278 statements in 762µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1411213µs418µsPerl::Critic::PolicyParameter::Behavior::Integer::::__ANON__[:82]Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[:82]
1411181µs242µsPerl::Critic::PolicyParameter::Behavior::Integer::::initialize_parameterPerl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter
141126µs26µsPerl::Critic::PolicyParameter::Behavior::Integer::::CORE:matchPerl::Critic::PolicyParameter::Behavior::Integer::CORE:match (opcode)
11115µs15µsPerl::Critic::PolicyParameter::Behavior::Integer::::BEGIN@10Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@10
1118µs61µsPerl::Critic::PolicyParameter::Behavior::Integer::::BEGIN@16Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@16
1117µs11µsPerl::Critic::PolicyParameter::Behavior::Integer::::BEGIN@12Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@12
1117µs249µsPerl::Critic::PolicyParameter::Behavior::Integer::::BEGIN@14Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@14
1116µs18µsPerl::Critic::PolicyParameter::Behavior::Integer::::BEGIN@11Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@11
0000s0sPerl::Critic::PolicyParameter::Behavior::Integer::::generate_parameter_descriptionPerl::Critic::PolicyParameter::Behavior::Integer::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::Integer;
9
10236µs115µs
# spent 15µs within Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@10 which was called: # once (15µs+0s) by Perl::Critic::PolicyParameter::BEGIN@26 at line 10
use 5.006001;
11219µs229µs
# spent 18µs (6+12) within Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@11 which was called: # once (6µs+12µs) by Perl::Critic::PolicyParameter::BEGIN@26 at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@11 # spent 12µs making 1 call to strict::import
12223µs215µs
# spent 11µs (7+4) within Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@12 which was called: # once (7µs+4µs) by Perl::Critic::PolicyParameter::BEGIN@26 at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@12 # spent 4µs making 1 call to warnings::import
13
14224µs2491µs
# spent 249µs (7+242) within Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@14 which was called: # once (7µs+242µs) by Perl::Critic::PolicyParameter::BEGIN@26 at line 14
use Perl::Critic::Utils qw{ :characters };
# spent 249µs making 1 call to Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@14 # spent 242µs making 1 call to Exporter::import
15
162328µs261µs
# spent 61µs (8+53) within Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@16 which was called: # once (8µs+53µs) by Perl::Critic::PolicyParameter::BEGIN@26 at line 16
use base qw{ Perl::Critic::PolicyParameter::Behavior };
# spent 61µs making 1 call to Perl::Critic::PolicyParameter::Behavior::Integer::BEGIN@16 # spent 53µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 53µs
17
181600nsour $VERSION = '1.121';
19
20#-----------------------------------------------------------------------------
21
22
# spent 242µs (181+60) within Perl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter which was called 14 times, avg 17µs/call: # 14 times (181µs+60µs) by Perl::Critic::PolicyParameter::_initialize_from_behavior at line 115 of Perl/Critic/PolicyParameter.pm, avg 17µs/call
sub initialize_parameter {
23144µs my ($self, $parameter, $specification) = @_;
24
25145µs my $minimum = $specification->{integer_minimum};
26144µs my $maximum = $specification->{integer_maximum};
27
281421µs1419µs $parameter->_get_behavior_values()->{minimum} = $minimum;
# spent 19µs making 14 calls to Perl::Critic::PolicyParameter::_get_behavior_values, avg 1µs/call
291416µs1415µs $parameter->_get_behavior_values()->{maximum} = $maximum;
# spent 15µs making 14 calls to Perl::Critic::PolicyParameter::_get_behavior_values, avg 1µs/call
30
31 $parameter->_set_parser(
32
# spent 418µs (213+204) within Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Integer.pm:82] which was called 14 times, avg 30µs/call: # 14 times (213µs+204µs) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm, avg 30µs/call
sub {
33 # Normally bad thing, obscuring a variable in a outer scope
34 # with a variable with the same name is being done here in
35 # order to remain consistent with the parser function interface.
36145µs my ($policy, $parameter, $config_string) = @_; ## no critic(Variables::ProhibitReusedNames)
37
381418µs1419µs my $value_string = $parameter->get_default_string();
# spent 19µs making 14 calls to Perl::Critic::PolicyParameter::get_default_string, avg 1µs/call
39
40143µs if (defined $config_string) {
41 $value_string = $config_string;
42 }
43
4414700ns my $value;
45144µs if ( defined $value_string ) {
461459µs1426µs if (
# spent 26µs making 14 calls to Perl::Critic::PolicyParameter::Behavior::Integer::CORE:match, avg 2µs/call
47 $value_string !~ m/ \A [-+]? [1-9] [\d_]* \z /xms
48 and $value_string ne '0'
49 ) {
50 $policy->throw_parameter_value_exception(
51 $parameter->get_name(),
52 $value_string,
53 undef,
54 'does not look like an integer.',
55 );
56 }
57
58148µs $value_string =~ tr/_//d;
591411µs $value = $value_string + 0;
60
61143µs if ( defined $minimum and $minimum > $value ) {
62 $policy->throw_parameter_value_exception(
63 $parameter->get_name(),
64 $value_string,
65 undef,
66 qq{is less than $minimum.},
67 );
68 }
69
70143µs if ( defined $maximum and $maximum < $value ) {
71 $policy->throw_parameter_value_exception(
72 $parameter->get_name(),
73 $value_string,
74 undef,
75 qq{is greater than $maximum.},
76 );
77 }
78 }
79
801453µs14158µs $policy->__set_parameter_value($parameter, $value);
# spent 158µs making 14 calls to Perl::Critic::Policy::__set_parameter_value, avg 11µs/call
811429µs return;
82 }
831452µs1426µs );
# spent 26µs making 14 calls to Perl::Critic::PolicyParameter::_set_parser, avg 2µs/call
84
851430µs return;
86}
87
88#-----------------------------------------------------------------------------
89
90sub generate_parameter_description {
91 my ($self, $parameter) = @_;
92
93 my $minimum = $parameter->_get_behavior_values()->{minimum};
94 my $maximum = $parameter->_get_behavior_values()->{maximum};
95
96 my $description = $parameter->_get_description_with_trailing_period();
97 if ( $description ) {
98 $description .= qq{\n};
99 }
100
101 if (defined $minimum or defined $maximum) {
102 if (defined $minimum) {
103 $description .= "Minimum value $minimum. ";
104 } else {
105 $description .= 'No minimum. ';
106 }
107
108 if (defined $maximum) {
109 $description .= "Maximum value $maximum.";
110 } else {
111 $description .= 'No maximum.';
112 }
113 } else {
114 $description .= 'No limits.';
115 }
116
117 return $description;
118}
119
120#-----------------------------------------------------------------------------
121
12212µs1;
123
124__END__
 
# spent 26µs within Perl::Critic::PolicyParameter::Behavior::Integer::CORE:match which was called 14 times, avg 2µs/call: # 14 times (26µs+0s) by Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Integer.pm:82] at line 46, avg 2µs/call
sub Perl::Critic::PolicyParameter::Behavior::Integer::CORE:match; # opcode