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

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Theme.pm
StatementsExecuted 620 statements in 1.62ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
14111923┬Ás11.9msPerl::Critic::Theme::::policy_is_thematicPerl::Critic::Theme::policy_is_thematic
22236┬Ás39┬ÁsPerl::Critic::Theme::::cook_rulePerl::Critic::Theme::cook_rule
11123┬Ás41┬ÁsPerl::Critic::Theme::::_initPerl::Critic::Theme::_init
11115┬Ás15┬ÁsPerl::Critic::Theme::::BEGIN@10Perl::Critic::Theme::BEGIN@10
11113┬Ás92┬ÁsPerl::Critic::Theme::::BEGIN@23Perl::Critic::Theme::BEGIN@23
11112┬Ás73┬ÁsPerl::Critic::Theme::::BEGIN@21Perl::Critic::Theme::BEGIN@21
11111┬Ás52┬ÁsPerl::Critic::Theme::::newPerl::Critic::Theme::new
11110┬Ás174┬ÁsPerl::Critic::Theme::::BEGIN@18Perl::Critic::Theme::BEGIN@18
1119┬Ás376┬ÁsPerl::Critic::Theme::::BEGIN@13Perl::Critic::Theme::BEGIN@13
1118┬Ás13┬ÁsPerl::Critic::Theme::::BEGIN@16Perl::Critic::Theme::BEGIN@16
1117┬Ás26┬ÁsPerl::Critic::Theme::::BEGIN@14Perl::Critic::Theme::BEGIN@14
1117┬Ás293┬ÁsPerl::Critic::Theme::::BEGIN@20Perl::Critic::Theme::BEGIN@20
1117┬Ás18┬ÁsPerl::Critic::Theme::::BEGIN@11Perl::Critic::Theme::BEGIN@11
1116┬Ás11┬ÁsPerl::Critic::Theme::::BEGIN@12Perl::Critic::Theme::BEGIN@12
1114┬Ás5┬ÁsPerl::Critic::Theme::::CORE:regcompPerl::Critic::Theme::CORE:regcomp (opcode)
14713┬Ás3┬ÁsPerl::Critic::Theme::::CORE:substPerl::Critic::Theme::CORE:subst (opcode)
1111┬Ás1┬ÁsPerl::Critic::Theme::::CORE:qrPerl::Critic::Theme::CORE:qr (opcode)
111300ns300nsPerl::Critic::Theme::::CORE:matchPerl::Critic::Theme::CORE:match (opcode)
0000s0sPerl::Critic::Theme::::rulePerl::Critic::Theme::rule
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::Theme;
9
10238┬Ás115┬Ás
# spent 15┬Ás within Perl::Critic::Theme::BEGIN@10 which was called: # once (15┬Ás+0s) by Perl::Critic::Config::BEGIN@25 at line 10
use 5.006001;
# spent 15┬Ás making 1 call to Perl::Critic::Theme::BEGIN@10
11219┬Ás230┬Ás
# spent 18┬Ás (7+11) within Perl::Critic::Theme::BEGIN@11 which was called: # once (7┬Ás+11┬Ás) by Perl::Critic::Config::BEGIN@25 at line 11
use strict;
# spent 18┬Ás making 1 call to Perl::Critic::Theme::BEGIN@11 # spent 11┬Ás making 1 call to strict::import
12219┬Ás216┬Ás
# spent 11┬Ás (6+5) within Perl::Critic::Theme::BEGIN@12 which was called: # once (6┬Ás+5┬Ás) by Perl::Critic::Config::BEGIN@25 at line 12
use warnings;
# spent 11┬Ás making 1 call to Perl::Critic::Theme::BEGIN@12 # spent 5┬Ás making 1 call to warnings::import
13224┬Ás2743┬Ás
# spent 376┬Ás (9+367) within Perl::Critic::Theme::BEGIN@13 which was called: # once (9┬Ás+367┬Ás) by Perl::Critic::Config::BEGIN@25 at line 13
use English qw(-no_match_vars);
# spent 376┬Ás making 1 call to Perl::Critic::Theme::BEGIN@13 # spent 367┬Ás making 1 call to English::import
14221┬Ás245┬Ás
# spent 26┬Ás (7+19) within Perl::Critic::Theme::BEGIN@14 which was called: # once (7┬Ás+19┬Ás) by Perl::Critic::Config::BEGIN@25 at line 14
use Readonly;
# spent 26┬Ás making 1 call to Perl::Critic::Theme::BEGIN@14 # spent 19┬Ás making 1 call to Exporter::import
15
16220┬Ás218┬Ás
# spent 13┬Ás (8+5) within Perl::Critic::Theme::BEGIN@16 which was called: # once (8┬Ás+5┬Ás) by Perl::Critic::Config::BEGIN@25 at line 16
use Exporter 'import';
# spent 13┬Ás making 1 call to Perl::Critic::Theme::BEGIN@16 # spent 5┬Ás making 1 call to Exporter::import
17
18227┬Ás2339┬Ás
# spent 174┬Ás (10+164) within Perl::Critic::Theme::BEGIN@18 which was called: # once (10┬Ás+164┬Ás) by Perl::Critic::Config::BEGIN@25 at line 18
use List::MoreUtils qw(any);
# spent 174┬Ás making 1 call to Perl::Critic::Theme::BEGIN@18 # spent 164┬Ás making 1 call to Exporter::Tiny::import
19
20223┬Ás2579┬Ás
# spent 293┬Ás (7+286) within Perl::Critic::Theme::BEGIN@20 which was called: # once (7┬Ás+286┬Ás) by Perl::Critic::Config::BEGIN@25 at line 20
use Perl::Critic::Utils qw{ :characters :data_conversion };
# spent 293┬Ás making 1 call to Perl::Critic::Theme::BEGIN@20 # spent 286┬Ás making 1 call to Exporter::import
21228┬Ás2134┬Ás
# spent 73┬Ás (12+61) within Perl::Critic::Theme::BEGIN@21 which was called: # once (12┬Ás+61┬Ás) by Perl::Critic::Config::BEGIN@25 at line 21
use Perl::Critic::Exception::Fatal::Internal qw{ &throw_internal };
# spent 73┬Ás making 1 call to Perl::Critic::Theme::BEGIN@21 # spent 61┬Ás making 1 call to Exporter::import
22use Perl::Critic::Exception::Configuration::Option::Global::ParameterValue
232466┬Ás2170┬Ás
# spent 92┬Ás (13+78) within Perl::Critic::Theme::BEGIN@23 which was called: # once (13┬Ás+78┬Ás) by Perl::Critic::Config::BEGIN@25 at line 23
qw{ &throw_global_value };
# spent 92┬Ás making 1 call to Perl::Critic::Theme::BEGIN@23 # spent 78┬Ás making 1 call to Exporter::import
24
25#-----------------------------------------------------------------------------
26
271700nsour $VERSION = '1.121';
28
29#-----------------------------------------------------------------------------
30
3112┬Ás126┬ÁsReadonly::Array our @EXPORT_OK => qw{
# spent 26┬Ás making 1 call to Readonly::Array
32 $RULE_INVALID_CHARACTER_REGEX
33 cook_rule
34};
35
36#-----------------------------------------------------------------------------
37
3816┬Ás226┬ÁsReadonly::Scalar our $RULE_INVALID_CHARACTER_REGEX =>
# spent 24┬Ás making 1 call to Readonly::Scalar # spent 1┬Ás making 1 call to Perl::Critic::Theme::CORE:qr
39 qr/ ( [^()\s\w\d+\-*&|!] ) /xms;
40
41#-----------------------------------------------------------------------------
42
431800ns120┬ÁsReadonly::Scalar my $CONFIG_KEY => 'theme';
# spent 20┬Ás making 1 call to Readonly::Scalar
44
45#-----------------------------------------------------------------------------
46
47
# spent 52┬Ás (11+41) within Perl::Critic::Theme::new which was called: # once (11┬Ás+41┬Ás) by Perl::Critic::Config::_validate_and_save_theme at line 659 of Perl/Critic/Config.pm
sub new {
48
4912┬Ás my ( $class, %args ) = @_;
5012┬Ás my $self = bless {}, $class;
5113┬Ás141┬Ás $self->_init( %args );
# spent 41┬Ás making 1 call to Perl::Critic::Theme::_init
5214┬Ás return $self;
53}
54
55#-----------------------------------------------------------------------------
56
57
# spent 41┬Ás (23+18) within Perl::Critic::Theme::_init which was called: # once (23┬Ás+18┬Ás) by Perl::Critic::Theme::new at line 51
sub _init {
58
5911┬Ás my ($self, %args) = @_;
6013┬Ás11┬Ás my $rule = $args{-rule} || $EMPTY;
# spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
61
62110┬Ás37┬Ás if ( $rule =~ m/$RULE_INVALID_CHARACTER_REGEX/xms ) {
# spent 5┬Ás making 1 call to Perl::Critic::Theme::CORE:regcomp # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH # spent 300ns making 1 call to Perl::Critic::Theme::CORE:match
63 throw_global_value
64 option_name => $CONFIG_KEY,
65 option_value => $rule,
66 message_suffix => qq{contains an invalid character: "$1".};
67 }
68
6915┬Ás111┬Ás $self->{_rule} = cook_rule( $rule );
# spent 11┬Ás making 1 call to Perl::Critic::Theme::cook_rule
70
7114┬Ás return $self;
72}
73
74#-----------------------------------------------------------------------------
75
76sub rule {
77 my $self = shift;
78 return $self->{_rule};
79}
80
81#-----------------------------------------------------------------------------
82
83
# spent 11.9ms (923┬Ás+11.0) within Perl::Critic::Theme::policy_is_thematic which was called 141 times, avg 85┬Ás/call: # 141 times (923┬Ás+11.0ms) by Perl::Critic::Config::_policy_is_thematic at line 281 of Perl/Critic/Config.pm, avg 85┬Ás/call
sub policy_is_thematic {
84
8514198┬Ás my ($self, %args) = @_;
86141332┬Ás14111.0ms my $policy = $args{-policy}
# spent 11.0ms making 141 calls to Perl::Critic::Policy::to_string, avg 78┬Ás/call
87 || throw_internal 'The -policy argument is required';
8814139┬Ás ref $policy
89 || throw_internal 'The -policy must be an object';
90
91141381┬Ás my $rule = $self->{_rule} or return 1;
92 my %themes = hashify( $policy->get_themes() );
93
94 # This bit of magic turns the rule into a perl expression that can be
95 # eval-ed for truth. Each theme name in the rule is translated to 1 or 0
96 # if the $policy belongs in that theme. For example:
97 #
98 # 'bugs && (pbp || core)' ...could become... '1 && (0 || 1)'
99
100 my $as_code = $rule; #Making a copy, so $rule is preserved
101 $as_code =~ s/ ( [\w\d]+ ) /exists $themes{$1} || 0/gexms;
102 my $is_thematic = eval $as_code; ## no critic (ProhibitStringyEval)
103
104 if ($EVAL_ERROR) {
105 throw_global_value
106 option_name => $CONFIG_KEY,
107 option_value => $rule,
108 message_suffix => q{contains a syntax error.};
109 }
110
111 return $is_thematic;
112}
113
114#-----------------------------------------------------------------------------
115
116
# spent 39┬Ás (36+3) within Perl::Critic::Theme::cook_rule which was called 2 times, avg 19┬Ás/call: # once (26┬Ás+2┬Ás) by Perl::Critic::Config::_validate_and_save_theme at line 640 of Perl/Critic/Config.pm # once (10┬Ás+900ns) by Perl::Critic::Theme::_init at line 69
sub cook_rule {
1172700ns my ($raw_rule) = @_;
1182400ns return if not defined $raw_rule;
119
120 #Translate logical operators
12127┬Ás2800ns $raw_rule =~ s{\b not \b}{!}ixmsg; # "not" -> "!"
# spent 800ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 400ns/call
12227┬Ás2300ns $raw_rule =~ s{\b and \b}{&&}ixmsg; # "and" -> "&&"
# spent 300ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 150ns/call
12324┬Ás2400ns $raw_rule =~ s{\b or \b}{||}ixmsg; # "or" -> "||"
# spent 400ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 200ns/call
124
125 #Translate algebra operators (for backward compatibility)
12623┬Ás2400ns $raw_rule =~ s{\A [-] }{!}ixmsg; # "-" -> "!" e.g. difference
# spent 400ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 200ns/call
12723┬Ás2400ns $raw_rule =~ s{ [-] }{&& !}ixmsg; # "-" -> "&& !" e.g. difference
# spent 400ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 200ns/call
12823┬Ás2300ns $raw_rule =~ s{ [*] }{&&}ixmsg; # "*" -> "&&" e.g. intersection
# spent 300ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 150ns/call
12924┬Ás2400ns $raw_rule =~ s{ [+] }{||}ixmsg; # "+" -> "||" e.g. union
# spent 400ns making 2 calls to Perl::Critic::Theme::CORE:subst, avg 200ns/call
130
13121┬Ás my $cooked_rule = lc $raw_rule; #Is now cooked!
13226┬Ás return $cooked_rule;
133}
134
135
13614┬Ás1;
137
138__END__
 
# spent 300ns within Perl::Critic::Theme::CORE:match which was called: # once (300ns+0s) by Perl::Critic::Theme::_init at line 62
sub Perl::Critic::Theme::CORE:match; # opcode
# spent 1┬Ás within Perl::Critic::Theme::CORE:qr which was called: # once (1┬Ás+0s) by Perl::Critic::Config::BEGIN@25 at line 38
sub Perl::Critic::Theme::CORE:qr; # opcode
# spent 5┬Ás (4+1000ns) within Perl::Critic::Theme::CORE:regcomp which was called: # once (4┬Ás+1000ns) by Perl::Critic::Theme::_init at line 62
sub Perl::Critic::Theme::CORE:regcomp; # opcode
# spent 3┬Ás within Perl::Critic::Theme::CORE:subst which was called 14 times, avg 214ns/call: # 2 times (800ns+0s) by Perl::Critic::Theme::cook_rule at line 121, avg 400ns/call # 2 times (400ns+0s) by Perl::Critic::Theme::cook_rule at line 127, avg 200ns/call # 2 times (400ns+0s) by Perl::Critic::Theme::cook_rule at line 126, avg 200ns/call # 2 times (400ns+0s) by Perl::Critic::Theme::cook_rule at line 123, avg 200ns/call # 2 times (400ns+0s) by Perl::Critic::Theme::cook_rule at line 129, avg 200ns/call # 2 times (300ns+0s) by Perl::Critic::Theme::cook_rule at line 122, avg 150ns/call # 2 times (300ns+0s) by Perl::Critic::Theme::cook_rule at line 128, avg 150ns/call
sub Perl::Critic::Theme::CORE:subst; # opcode