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

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm
StatementsExecuted 27190 statements in 83.4ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1348111112ms151msPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::violatesPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates
14411281µs281µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::applies_toPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::applies_to
61177µs189µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_recover_open_encodingPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding
62155µs98µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_get_argument_stringPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_get_argument_string
11116µs16µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@10Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@10
51115µs15µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::CORE:substPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst (opcode)
11110µs21µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@11Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11
1118µs16µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_recover_binmode_encodingPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding
1117µs9µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::default_severityPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::default_severity
1117µs11µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@12Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@12
1117µs28µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@14Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14
1117µs20µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@16Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16
1117µs62µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@19Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19
1117µs188µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@18Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18
1112µs2µsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::supported_parametersPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::supported_parameters
111300ns300nsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::CORE:matchPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match (opcode)
0000s0sPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::default_themesPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm $
3# $Date: 2010-06-22 16:14:07 -0400 (Tue, 22 Jun 2010) $
4# $Author: clonezone $
5# $Revision: 3843 $
6##############################################################################
7
8package Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer;
9
10239µs116µs
# spent 16µs within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs232µs
# spent 21µs (10+11) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11 which was called: # once (10µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 21µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11 # spent 11µs making 1 call to strict::import
12218µs215µs
# spent 11µs (7+4) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@12 which was called: # once (7µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@12 # spent 4µs making 1 call to warnings::import
13
14219µs249µs
# spent 28µs (7+21) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14 which was called: # once (7µs+21µs) by Module::Pluggable::Object::_require at line 14
use Readonly;
# spent 28µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14 # spent 21µs making 1 call to Exporter::import
15
16221µs233µs
# spent 20µs (7+13) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16 which was called: # once (7µs+13µs) by Module::Pluggable::Object::_require at line 16
use version;
# spent 20µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16 # spent 13µs making 1 call to version::import
17
18222µs2369µs
# spent 188µs (7+181) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18 which was called: # once (7µs+181µs) by Module::Pluggable::Object::_require at line 18
use Perl::Critic::Utils qw{ :severities :ppi };
# spent 188µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18 # spent 181µs making 1 call to Exporter::import
192327µs2116µs
# spent 62µs (7+55) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19 which was called: # once (7µs+55µs) by Module::Pluggable::Object::_require at line 19
use base 'Perl::Critic::Policy';
# spent 62µs making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19 # spent 55µs making 1 call to base::import
20
211600nsour $VERSION = '1.121';
22
23#-----------------------------------------------------------------------------
24
2512µs129µsReadonly::Scalar my $DESC => q{I/O layer ":utf8" used};
# spent 29µs making 1 call to Readonly::Scalar
2611µs121µsReadonly::Scalar my $EXPL => q{Use ":encoding(UTF-8)" to get strict validation};
# spent 21µs making 1 call to Readonly::Scalar
27
281900ns120µsReadonly::Scalar my $THREE_ARGUMENT_OPEN => 3;
# spent 20µs making 1 call to Readonly::Scalar
2912µs123µsReadonly::Hash my %RECOVER_ENCODING => (
# spent 23µs making 1 call to Readonly::Hash
30 binmode => \&_recover_binmode_encoding,
31 open => \&_recover_open_encoding,
32);
33
34#-----------------------------------------------------------------------------
35
3615µs
# spent 2µs within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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 () }
3712µs
# spent 9µs (7+2) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::default_severity which was called: # once (7µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_HIGHEST }
38sub default_themes { return qw(core bugs security) }
39144368µs
# spent 281µs within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::applies_to which was called 144 times, avg 2µs/call: # 144 times (281µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call
sub applies_to { return 'PPI::Token::Word' }
40
41#-----------------------------------------------------------------------------
42
43
# spent 151ms (112+38.6) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates which was called 13481 times, avg 11µs/call: # 13481 times (112ms+38.6ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 11µs/call
sub violates {
44134813.05ms my ($self, $elem, $document) = @_;
45
461348179.4ms2696234.8ms my $handler = $RECOVER_ENCODING{ $elem->content() }
# spent 18.5ms making 13481 calls to Readonly::Hash::FETCH, avg 1µs/call # spent 16.4ms making 13481 calls to PPI::Token::content, avg 1µs/call
47 or return; # If we don't have a handler, we're not interested.
48734µs143.73ms my $encoding = $handler->( parse_arg_list( $elem ) )
49 or return; # If we can't recover an encoding, we give up.
5019µs1300ns return if $encoding !~ m/ (?: \A | : ) utf8 \b /smxi; # OK
51
52 return $self->violation( $DESC, $EXPL, $elem );
53}
54
55#-----------------------------------------------------------------------------
56
57# my $string = _get_argument_string( $arg[1] );
58#
59# This subroutine returns the string from the given argument (which must
60# be a reference to an array of PPI objects), _PROVIDED_ the array
61# contains a single PPI::Token::Quote object. Otherwise it simply
62# returns, since we're too stupid to analyze anything else.
63
64
# spent 98µs (55+42) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_get_argument_string which was called 6 times, avg 16µs/call: # 5 times (48µs+41µs) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding at line 95, avg 18µs/call # once (6µs+1µs) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding at line 81
sub _get_argument_string {
6562µs my ( $arg ) = @_;
6664µs ref $arg eq 'ARRAY' or return;
6765µs return if @{ $arg } == 0 || @{ $arg } > 1;
68647µs1142µs return $arg->[0]->string() if $arg->[0]->isa( 'PPI::Token::Quote' );
# spent 19µs making 1 call to PPI::Token::Quote::Literal::string # spent 18µs making 4 calls to PPI::Token::Quote::Single::string, avg 4µs/call # spent 6µs making 6 calls to UNIVERSAL::isa, avg 917ns/call
6915µs return;
70}
71
72#-----------------------------------------------------------------------------
73
74# my $encoding = _recover_binmode_encoding( _parse_arg_list( $elem ) );
75#
76# This subroutine returns the encoding specified by the given $elem,
77# which _MUST_ be the 'binmode' of a binmode() call.
78
79
# spent 16µs (8+8) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding which was called: # once (8µs+8µs) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 48
sub _recover_binmode_encoding {
801900ns my ( @args ) = @_;
8115µs18µs return _get_argument_string( $args[1] );
82}
83
84#-----------------------------------------------------------------------------
85
86# my $encoding = _recover_open_encoding( _parse_arg_list( $elem ) );
87#
88# This subroutine returns the encoding specified by the given $elem,
89# which _MUST_ be the 'open' of a open() call.
90
91
# spent 189µs (77+111) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding which was called 6 times, avg 31µs/call: # 6 times (77µs+111µs) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 48, avg 31µs/call
sub _recover_open_encoding {
9264µs my ( @args ) = @_;
93616µs66µs @args < $THREE_ARGUMENT_OPEN
# spent 6µs making 6 calls to Readonly::Scalar::FETCH, avg 1µs/call
94 and return;
95511µs590µs defined( my $string = _get_argument_string( $args[1] ) )
96 or return;
97531µs515µs $string =~ s/ [+]? (?: < | >{1,2} ) //smx;
# spent 15µs making 5 calls to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst, avg 3µs/call
98515µs return $string;
99}
100
10115µs1;
102
103__END__
 
# spent 300ns within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match which was called: # once (300ns+0s) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 50
sub Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match; # opcode
# spent 15µs within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst which was called 5 times, avg 3µs/call: # 5 times (15µs+0s) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding at line 97, avg 3µs/call
sub Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst; # opcode