← 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/Exception/Class/Base.pm
StatementsExecuted 11087 statements in 23.7ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4241124.1ms253msException::Class::Base::::_initializeException::Class::Base::_initialize
424112.23ms255msException::Class::Base::::newException::Class::Base::new
1111.19ms2.12msException::Class::Base::::BEGIN@7Exception::Class::Base::BEGIN@7
42411520┬Ás520┬ÁsException::Class::Base::::CORE:matchException::Class::Base::CORE:match (opcode)
42411334┬Ás334┬ÁsException::Class::Base::::FieldsException::Class::Base::Fields
111265┬Ás328┬ÁsException::Class::Base::::BEGIN@6Exception::Class::Base::BEGIN@6
11148┬Ás48┬ÁsException::Class::Base::::BEGIN@35Exception::Class::Base::BEGIN@35
11141┬Ás94┬ÁsException::Class::Base::::BEGIN@12Exception::Class::Base::BEGIN@12
11119┬Ás26┬ÁsException::Class::Base::::BEGIN@4Exception::Class::Base::BEGIN@4
11116┬Ás38┬ÁsException::Class::Base::::BEGIN@3Exception::Class::Base::BEGIN@3
11110┬Ás87┬ÁsException::Class::Base::::BEGIN@10Exception::Class::Base::BEGIN@10
1119┬Ás43┬ÁsException::Class::Base::::BEGIN@32Exception::Class::Base::BEGIN@32
1119┬Ás35┬ÁsException::Class::Base::::BEGIN@8Exception::Class::Base::BEGIN@8
1118┬Ás20┬ÁsException::Class::Base::::BEGIN@41Exception::Class::Base::BEGIN@41
1118┬Ás18┬ÁsException::Class::Base::::BEGIN@61Exception::Class::Base::BEGIN@61
4417┬Ás7┬ÁsException::Class::Base::::__ANON__[:32]Exception::Class::Base::__ANON__[:32]
0000s0sException::Class::Base::::ClassesException::Class::Base::Classes
0000s0sException::Class::Base::::__ANON__[:39]Exception::Class::Base::__ANON__[:39]
0000s0sException::Class::Base::::__ANON__[:60]Exception::Class::Base::__ANON__[:60]
0000s0sException::Class::Base::::as_stringException::Class::Base::as_string
0000s0sException::Class::Base::::caughtException::Class::Base::caught
0000s0sException::Class::Base::::context_hashException::Class::Base::context_hash
0000s0sException::Class::Base::::descriptionException::Class::Base::description
0000s0sException::Class::Base::::field_hashException::Class::Base::field_hash
0000s0sException::Class::Base::::full_messageException::Class::Base::full_message
0000s0sException::Class::Base::::rethrowException::Class::Base::rethrow
0000s0sException::Class::Base::::show_traceException::Class::Base::show_trace
0000s0sException::Class::Base::::throwException::Class::Base::throw
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Exception::Class::Base;
21700ns$Exception::Class::Base::VERSION = '1.38';
3227┬Ás259┬Ás
# spent 38┬Ás (16+21) within Exception::Class::Base::BEGIN@3 which was called: # once (16┬Ás+21┬Ás) by Exception::Class::BEGIN@7 at line 3
use strict;
# spent 38┬Ás making 1 call to Exception::Class::Base::BEGIN@3 # spent 21┬Ás making 1 call to strict::import
4229┬Ás232┬Ás
# spent 26┬Ás (19+6) within Exception::Class::Base::BEGIN@4 which was called: # once (19┬Ás+6┬Ás) by Exception::Class::BEGIN@7 at line 4
use warnings;
# spent 26┬Ás making 1 call to Exception::Class::Base::BEGIN@4 # spent 6┬Ás making 1 call to warnings::import
5
63119┬Ás2338┬Ás
# spent 328┬Ás (265+62) within Exception::Class::Base::BEGIN@6 which was called: # once (265┬Ás+62┬Ás) by Exception::Class::BEGIN@7 at line 6
use Class::Data::Inheritable 0.02;
# spent 328┬Ás making 1 call to Exception::Class::Base::BEGIN@6 # spent 10┬Ás making 1 call to UNIVERSAL::VERSION
73119┬Ás22.13ms
# spent 2.12ms (1.19+938┬Ás) within Exception::Class::Base::BEGIN@7 which was called: # once (1.19ms+938┬Ás) by Exception::Class::BEGIN@7 at line 7
use Devel::StackTrace 1.20;
# spent 2.12ms making 1 call to Exception::Class::Base::BEGIN@7 # spent 10┬Ás making 1 call to UNIVERSAL::VERSION
8226┬Ás261┬Ás
# spent 35┬Ás (9+26) within Exception::Class::Base::BEGIN@8 which was called: # once (9┬Ás+26┬Ás) by Exception::Class::BEGIN@7 at line 8
use Scalar::Util qw( blessed );
# spent 35┬Ás making 1 call to Exception::Class::Base::BEGIN@8 # spent 26┬Ás making 1 call to Exporter::import
9
10275┬Ás2164┬Ás
# spent 87┬Ás (10+77) within Exception::Class::Base::BEGIN@10 which was called: # once (10┬Ás+77┬Ás) by Exception::Class::BEGIN@7 at line 10
use base qw(Class::Data::Inheritable);
# spent 87┬Ás making 1 call to Exception::Class::Base::BEGIN@10 # spent 77┬Ás making 1 call to base::import
11
12
# spent 94┬Ás (41+54) within Exception::Class::Base::BEGIN@12 which was called: # once (41┬Ás+54┬Ás) by Exception::Class::BEGIN@7 at line 27
BEGIN {
1313┬Ás111┬Ás __PACKAGE__->mk_classdata('Trace');
# spent 11┬Ás making 1 call to Class::Data::Inheritable::mk_classdata
1411┬Ás18┬Ás __PACKAGE__->mk_classdata('NoRefs');
# spent 8┬Ás making 1 call to Class::Data::Inheritable::mk_classdata
1511┬Ás13┬Ás __PACKAGE__->NoRefs(1);
16
1711┬Ás17┬Ás __PACKAGE__->mk_classdata('NoContextInfo');
# spent 7┬Ás making 1 call to Class::Data::Inheritable::mk_classdata
1811┬Ás12┬Ás __PACKAGE__->NoContextInfo(0);
19
2011┬Ás111┬Ás __PACKAGE__->mk_classdata('RespectOverload');
# spent 11┬Ás making 1 call to Class::Data::Inheritable::mk_classdata
2111┬Ás12┬Ás __PACKAGE__->RespectOverload(0);
22
2311┬Ás18┬Ás __PACKAGE__->mk_classdata('MaxArgLength');
# spent 8┬Ás making 1 call to Class::Data::Inheritable::mk_classdata
2415┬Ás12┬Ás __PACKAGE__->MaxArgLength(0);
25
264243.92ms
# spent 334┬Ás within Exception::Class::Base::Fields which was called 424 times, avg 789ns/call: # 424 times (334┬Ás+0s) by Perl::Critic::Exception::AggregateConfiguration::Fields at line 13 of (eval 46)[Exception/Class.pm:177], avg 789ns/call
sub Fields { () }
27134┬Ás194┬Ás}
# spent 94┬Ás making 1 call to Exception::Class::Base::BEGIN@12
28
29use overload
30
31 # an exception is always true
32680┬Ás277┬Ás
# spent 43┬Ás (9+34) within Exception::Class::Base::BEGIN@32 which was called: # once (9┬Ás+34┬Ás) by Exception::Class::BEGIN@7 at line 32 # spent 7┬Ás within Exception::Class::Base::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Exception/Class/Base.pm:32] which was called 4 times, avg 2┬Ás/call: # once (3┬Ás+0s) by Perl::Critic::PolicyFactory::_init at line 149 of Perl/Critic/PolicyFactory.pm # once (2┬Ás+0s) by Perl::Critic::PolicyFactory::create_all_policies at line 229 of Perl/Critic/PolicyFactory.pm # once (1┬Ás+0s) by Perl::Critic::PolicyFactory::_init at line 161 of Perl/Critic/PolicyFactory.pm # once (800ns+0s) by Perl::Critic::PolicyFactory::create_all_policies at line 213 of Perl/Critic/PolicyFactory.pm
bool => sub { 1 }, '""' => 'as_string', fallback => 1;
# spent 43┬Ás making 1 call to Exception::Class::Base::BEGIN@32 # spent 34┬Ás making 1 call to overload::import
33
34# Create accessor routines
35
# spent 48┬Ás within Exception::Class::Base::BEGIN@35 which was called: # once (48┬Ás+0s) by Exception::Class::BEGIN@7 at line 64
BEGIN {
3612┬Ás my @fields = qw( message pid uid euid gid egid time trace );
37
381700ns foreach my $f (@fields) {
3989┬Ás my $sub = sub { my $s = shift; return $s->{$f}; };
40
412109┬Ás231┬Ás
# spent 20┬Ás (8+11) within Exception::Class::Base::BEGIN@41 which was called: # once (8┬Ás+11┬Ás) by Exception::Class::BEGIN@7 at line 41
no strict 'refs';
# spent 20┬Ás making 1 call to Exception::Class::Base::BEGIN@41 # spent 11┬Ás making 1 call to strict::unimport
42815┬Ás *{$f} = $sub;
43 }
441500ns *error = \&message;
45
4612┬Ás my %trace_fields = (
47 package => 'package',
48 file => 'filename',
49 line => 'line',
50 );
51
5219┬Ás while ( my ( $f, $m ) = each %trace_fields ) {
53 my $sub = sub {
54 my $s = shift;
55 return $s->{$f} if exists $s->{$f};
56
57 my $frame = $s->trace->frame(0);
58
59 return $s->{$f} = $frame ? $frame->$m() : undef;
6034┬Ás };
61230┬Ás229┬Ás
# spent 18┬Ás (8+10) within Exception::Class::Base::BEGIN@61 which was called: # once (8┬Ás+10┬Ás) by Exception::Class::BEGIN@7 at line 61
no strict 'refs';
# spent 18┬Ás making 1 call to Exception::Class::Base::BEGIN@61 # spent 10┬Ás making 1 call to strict::unimport
6233┬Ás *{$f} = $sub;
63 }
641679┬Ás148┬Ás}
# spent 48┬Ás making 1 call to Exception::Class::Base::BEGIN@35
65
66sub Classes { Exception::Class::Classes() }
67
68sub throw {
69 my $proto = shift;
70
71 $proto->rethrow if ref $proto;
72
73 die $proto->new(@_);
74}
75
76sub rethrow {
77 my $self = shift;
78
79 die $self;
80}
81
82
# spent 255ms (2.23+253) within Exception::Class::Base::new which was called 424 times, avg 602┬Ás/call: # 424 times (2.23ms+253ms) by Perl::Critic::Exception::AggregateConfiguration::new at line 47 of Perl/Critic/Exception/AggregateConfiguration.pm, avg 602┬Ás/call
sub new {
8342493┬Ás my $proto = shift;
8442488┬Ás my $class = ref $proto || $proto;
85
86424501┬Ás my $self = bless {}, $class;
87
88424480┬Ás424253ms $self->_initialize(@_);
# spent 253ms making 424 calls to Exception::Class::Base::_initialize, avg 597┬Ás/call
89
90424770┬Ás return $self;
91}
92
93
# spent 253ms (24.1+229) within Exception::Class::Base::_initialize which was called 424 times, avg 597┬Ás/call: # 424 times (24.1ms+229ms) by Exception::Class::Base::new at line 88, avg 597┬Ás/call
sub _initialize {
9442446┬Ás my $self = shift;
95424312┬Ás my %p = @_ == 1 ? ( error => $_[0] ) : @_;
96
97424462┬Ás $self->{message} = $p{message} || $p{error} || '';
98
9942489┬Ás $self->{show_trace} = $p{show_trace} if exists $p{show_trace};
100
101424634┬Ás424852┬Ás if ( $self->NoContextInfo() ) {
# spent 852┬Ás making 424 calls to Class::Data::Inheritable::__ANON__[Class/Data/Inheritable.pm:23], avg 2┬Ás/call
102 $self->{show_trace} = 0;
103 $self->{package} = $self->{file} = $self->{line} = undef;
104 }
105 else {
106 # CORE::time is important to fix an error with some versions of
107 # Perl
108424372┬Ás $self->{time} = CORE::time();
109424267┬Ás $self->{pid} = $$;
110424479┬Ás $self->{uid} = $<;
111424267┬Ás $self->{euid} = $>;
1124241.57ms $self->{gid} = $(;
1134241.09ms $self->{egid} = $);
114
115424259┬Ás my @ignore_class = (__PACKAGE__);
116424145┬Ás my @ignore_package = 'Exception::Class';
117
118424163┬Ás if ( my $i = delete $p{ignore_class} ) {
119 push @ignore_class, ( ref($i) eq 'ARRAY' ? @$i : $i );
120 }
121
12242453┬Ás if ( my $i = delete $p{ignore_package} ) {
123 push @ignore_package, ( ref($i) eq 'ARRAY' ? @$i : $i );
124 }
125
1264242.52ms1696223ms $self->{trace} = Devel::StackTrace->new(
# spent 221ms making 424 calls to Devel::StackTrace::new, avg 520┬Ás/call # spent 2.06ms making 1272 calls to Class::Data::Inheritable::__ANON__[Class/Data/Inheritable.pm:23], avg 2┬Ás/call
127 ignore_class => \@ignore_class,
128 ignore_package => \@ignore_package,
129 no_refs => $self->NoRefs,
130 respect_overload => $self->RespectOverload,
131 max_arg_length => $self->MaxArgLength,
132 );
133 }
134
1354241.32ms4245.17ms my %fields = map { $_ => 1 } $self->Fields;
# spent 5.17ms making 424 calls to Perl::Critic::Exception::AggregateConfiguration::Fields, avg 12┬Ás/call
1364241.51ms while ( my ( $key, $value ) = each %p ) {
1374244.60ms424520┬Ás next if $key =~ /^(?:error|message|show_trace)$/;
# spent 520┬Ás making 424 calls to Exception::Class::Base::CORE:match, avg 1┬Ás/call
138
139424323┬Ás if ( $fields{$key} ) {
140 $self->{$key} = $value;
141 }
142 else {
143 Exception::Class::Base->throw(
144 error => "unknown field $key passed to constructor for class "
145 . ref $self );
146 }
147 }
148}
149
150sub context_hash {
151 my $self = shift;
152
153 return {
154 time => $self->{time},
155 pid => $self->{pid},
156 uid => $self->{uid},
157 euid => $self->{euid},
158 gid => $self->{gid},
159 egid => $self->{egid},
160 };
161}
162
163sub field_hash {
164 my $self = shift;
165
166 my $hash = {};
167
168 for my $field ( $self->Fields ) {
169 $hash->{$field} = $self->$field;
170 }
171
172 return $hash;
173}
174
175sub description {
176 return 'Generic exception';
177}
178
179sub show_trace {
180 my $self = shift;
181
182 return 0 unless $self->{trace};
183
184 if (@_) {
185 $self->{show_trace} = shift;
186 }
187
188 return exists $self->{show_trace} ? $self->{show_trace} : $self->Trace;
189}
190
191sub as_string {
192 my $self = shift;
193
194 my $str = $self->full_message;
195 unless ( defined $str && length $str ) {
196 my $desc = $self->description;
197 $str = defined $desc
198 && length $desc ? "[$desc]" : "[Generic exception]";
199 }
200
201 $str .= "\n\n" . $self->trace->as_string
202 if $self->show_trace;
203
204 return $str;
205}
206
207sub full_message { $_[0]->{message} }
208
209#
210# The %seen bit protects against circular inheritance.
211#
2121900nseval <<'EOF' if $] == 5.006;
213sub isa {
214 my ( $inheritor, $base ) = @_;
215 $inheritor = ref($inheritor) if ref($inheritor);
216
217 my %seen;
218
219 no strict 'refs';
220 my @parents = ( $inheritor, @{"$inheritor\::ISA"} );
221 while ( my $class = shift @parents ) {
222 return 1 if $class eq $base;
223
224 push @parents, grep { !$seen{$_}++ } @{"$class\::ISA"};
225 }
226 return 0;
227}
228EOF
229
230sub caught {
231 my $class = shift;
232
233 my $e = $@;
234
235 return unless defined $e && blessed($e) && $e->isa($class);
236 return $e;
237}
238
23918┬Ás1;
240
241# ABSTRACT: A base class for exception objects
242
243__END__
 
# spent 520┬Ás within Exception::Class::Base::CORE:match which was called 424 times, avg 1┬Ás/call: # 424 times (520┬Ás+0s) by Exception::Class::Base::_initialize at line 137, avg 1┬Ás/call
sub Exception::Class::Base::CORE:match; # opcode