← 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/Path/FindDev/Object.pm
StatementsExecuted 183 statements in 1.59ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111785µs1.28msPath::FindDev::Object::::__ANON__[:47]Path::FindDev::Object::__ANON__[:47]
111196µs108msPath::FindDev::Object::::find_devPath::FindDev::Object::find_dev
1111152µs107msPath::FindDev::Object::::_stepPath::FindDev::Object::_step
123128µs28µsPath::FindDev::Object::::_debugPath::FindDev::Object::_debug
11119µs341µsPath::FindDev::Object::::BEGIN@40Path::FindDev::Object::BEGIN@40
101116µs16µsPath::FindDev::Object::::has_uplevel_maxPath::FindDev::Object::has_uplevel_max
11116µs16µsPath::FindDev::::BEGIN@1 Path::FindDev::BEGIN@1
1119µs11µsPath::FindDev::::BEGIN@4 Path::FindDev::BEGIN@4
1117µs11µsPath::FindDev::::BEGIN@3 Path::FindDev::BEGIN@3
1116µs18µsPath::FindDev::::BEGIN@2 Path::FindDev::BEGIN@2
1115µs5µsPath::FindDev::Object::::has_setPath::FindDev::Object::has_set
1112µs2µsPath::FindDev::Object::::BUILDPath::FindDev::Object::BUILD
0000s0sPath::FindDev::Object::::__ANON__[:43]Path::FindDev::Object::__ANON__[:43]
0000s0sPath::FindDev::Object::::_errorPath::FindDev::Object::_error
0000s0sPath::FindDev::Object::::_instance_idPath::FindDev::Object::_instance_id
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1240µs116µs
# spent 16µs within Path::FindDev::BEGIN@1 which was called: # once (16µs+0s) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 1
use 5.008; # utf8
# spent 16µs making 1 call to Path::FindDev::BEGIN@1
2223µs230µs
# spent 18µs (6+12) within Path::FindDev::BEGIN@2 which was called: # once (6µs+12µs) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 2
use strict;
# spent 18µs making 1 call to Path::FindDev::BEGIN@2 # spent 12µs making 1 call to strict::import
3222µs215µs
# spent 11µs (7+4) within Path::FindDev::BEGIN@3 which was called: # once (7µs+4µs) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 3
use warnings;
# spent 11µs making 1 call to Path::FindDev::BEGIN@3 # spent 4µs making 1 call to warnings::import
42132µs213µs
# spent 11µs (9+2) within Path::FindDev::BEGIN@4 which was called: # once (9µs+2µs) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 4
use utf8;
# spent 11µs making 1 call to Path::FindDev::BEGIN@4 # spent 2µs making 1 call to utf8::import
5
6package Path::FindDev::Object;
71600ns$Path::FindDev::Object::VERSION = '0.5.0';
8# ABSTRACT: Object oriented guts to FindDev
9
101200nsour $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
11
121100nsour $ENV_KEY_DEBUG = 'PATH_FINDDEV_DEBUG';
131700nsour $DEBUG = ( exists $ENV{$ENV_KEY_DEBUG} ? $ENV{$ENV_KEY_DEBUG} : undef );
14
- -
40
# spent 341µs (19+322) within Path::FindDev::Object::BEGIN@40 which was called: # once (19µs+322µs) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 48
use Class::Tiny 0.010 'set', 'uplevel_max', {
41 nest_retry => sub {
42 return 0;
43 },
44
# spent 1.28ms (785µs+497µs) within Path::FindDev::Object::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev/Object.pm:47] which was called: # once (785µs+497µs) by Path::FindDev::Object::isdev at line 1 of (eval 287)[Class/Tiny.pm:56]
isdev => sub {
45160µs require Path::IsDev::Object;
4619µs245µs return Path::IsDev::Object->new( ( $_[0]->has_set ? ( set => $_[0]->set ) : () ) );
# spent 40µs making 1 call to Class::Tiny::Object::new # spent 5µs making 1 call to Path::FindDev::Object::has_set
47 },
483536µs3662µs};
# spent 341µs making 1 call to Path::FindDev::Object::BEGIN@40 # spent 314µs making 1 call to Class::Tiny::import # spent 8µs making 1 call to UNIVERSAL::VERSION
49
- -
58## no critic (RequireArgUnpacking)
59
- -
6619µs
# spent 5µs within Path::FindDev::Object::has_set which was called: # once (5µs+0s) by Path::FindDev::Object::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev/Object.pm:47] at line 46
sub has_set { return exists $_[0]->{set} }
67
- -
821026µs
# spent 16µs within Path::FindDev::Object::has_uplevel_max which was called 10 times, avg 2µs/call: # 10 times (16µs+0s) by Path::FindDev::Object::_step at line 210, avg 2µs/call
sub has_uplevel_max { return exists $_[0]->{uplevel_max} }
83
- -
1011500nsmy $instances = {};
1021100nsmy $instance_id = 0;
103
- -
117sub _instance_id {
118 my ($self) = @_;
119 require Scalar::Util;
120 my $addr = Scalar::Util::refaddr($self);
121 return $instances->{$addr} if exists $instances->{$addr};
122 $instances->{$addr} = sprintf '%x', $instance_id++;
123 return $instances->{$addr};
124}
125
- -
135
# spent 2µs within Path::FindDev::Object::BUILD which was called: # once (2µs+0s) by Class::Tiny::Object::new at line 126 of Class/Tiny.pm
sub BUILD {
1361200ns my ($self) = @_;
13714µs return $self unless $DEBUG;
138 $self->_debug('{');
139 $self->_debug( ' set => ' . $self->set ) if $self->has_set;
140 $self->_debug( ' uplevel_max => ' . $self->uplevel_max ) if $self->uplevel_max;
141 $self->_debug( ' nest_retry => ' . $self->nest_retry );
142 $self->_debug( ' isdev => ' . $self->isdev );
143 $self->_debug('}');
144 return $self;
145}
146
- -
159
# spent 28µs within Path::FindDev::Object::_debug which was called 12 times, avg 2µs/call: # 10 times (25µs+0s) by Path::FindDev::Object::find_dev at line 237, avg 3µs/call # once (2µs+0s) by Path::FindDev::Object::_step at line 207 # once (2µs+0s) by Path::FindDev::Object::find_dev at line 230
sub _debug {
160125µs my ( $self, $message ) = @_;
1611228µs return unless $DEBUG;
162 my $id = $self->_instance_id;
163 return *STDERR->printf( qq{[Path::FindDev=%s] %s\n}, $id, $message );
164}
165
- -
174sub _error {
175 my ( $self, $message ) = @_;
176 my $id = $self->_instance_id;
177 my $f_message = sprintf qq{[Path::FindDev=%s] %s\n}, $id, $message;
178 require Carp;
179 Carp::croak($f_message);
180}
181
- -
197
# spent 107ms (152µs+107) within Path::FindDev::Object::_step which was called 11 times, avg 9.76ms/call: # 11 times (152µs+107ms) by Path::FindDev::Object::find_dev at line 235, avg 9.76ms/call
sub _step {
198114µs my ( $self, $search_root, $dev_levels, $uplevels ) = @_;
199
20011475µs33107ms if ( $self->isdev->matches($search_root) ) {
# spent 106ms making 11 calls to Path::IsDev::Object::matches, avg 9.61ms/call # spent 1.31ms making 11 calls to Path::FindDev::Object::isdev, avg 119µs/call # spent 71µs making 11 calls to Class::Tiny::Object::DESTROY, avg 6µs/call
201 $self->_debug( 'Found dev dir' . $search_root );
202 ${$dev_levels}++;
203 return { type => 'found', path => $search_root } if ${$dev_levels} >= $self->nest_retry;
204 $self->_debug( sprintf 'Ignoring found dev dir due to dev_levels(%s) < nest_retry(%s)', ${$dev_levels}, $self->nest_retry );
205 }
2061119µs11221µs if ( $search_root->is_rootdir ) {
# spent 221µs making 11 calls to Path::Tiny::is_rootdir, avg 20µs/call
20712µs12µs $self->_debug('OS Root hit ( ->is_rootdir )');
# spent 2µs making 1 call to Path::FindDev::Object::_debug
20813µs return { type => 'stop' };
209 }
2101016µs1016µs if ( $self->has_uplevel_max and ${$uplevels} > $self->uplevel_max ) {
# spent 16µs making 10 calls to Path::FindDev::Object::has_uplevel_max, avg 2µs/call
211 $self->_debug( 'Stopping search due to uplevels(%s) >= uplevel_max(%s)', ${$uplevels}, $self->uplevel_max );
212 return { type => 'stop' };
213 }
214
2151031µs return { type => 'next' };
216}
217
- -
226
# spent 108ms (196µs+108) within Path::FindDev::Object::find_dev which was called: # once (196µs+108ms) by Path::FindDev::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Path/FindDev.pm:81] at line 80 of Path/FindDev.pm
sub find_dev {
2271200ns my ( $self, $path ) = @_;
2281200ns require Path::Tiny;
22914µs3127µs my $search_root = Path::Tiny::path($path)->absolute->realpath;
# spent 87µs making 1 call to Path::Tiny::realpath # spent 31µs making 1 call to Path::Tiny::absolute # spent 10µs making 1 call to Path::Tiny::path
23014µs23µs $self->_debug( 'Finding dev for ' . $path );
# spent 2µs making 1 call to Path::FindDev::Object::_debug # spent 2µs making 1 call to Path::Tiny::__ANON__[Path/Tiny.pm:31]
2311200ns my $dev_levels = 0;
2321100ns my $uplevels = 0 - 1;
233112µsFLOW: {
2341100ns $uplevels++;
2351119µs11107ms my $result = $self->_step( $search_root, \$dev_levels, \$uplevels );
# spent 107ms making 11 calls to Path::FindDev::Object::_step, avg 9.76ms/call
236116µs if ( 'next' eq $result->{type} ) {
2371068µs30318µs $self->_debug( 'Trying ../ : ' . $search_root->parent );
# spent 279µs making 10 calls to Path::Tiny::parent, avg 28µs/call # spent 25µs making 10 calls to Path::FindDev::Object::_debug, avg 3µs/call # spent 14µs making 10 calls to Path::Tiny::__ANON__[Path/Tiny.pm:31], avg 1µs/call
2381020µs10227µs $search_root = $search_root->parent;
# spent 227µs making 10 calls to Path::Tiny::parent, avg 23µs/call
2391011µs redo FLOW;
240 }
24118µs if ( 'stop' eq $result->{type} ) {
242 return;
243 }
244 if ( 'found' eq $result->{type} ) {
245 return $result->{path};
246 }
247 $self->_error( 'Unexpected end of flow control with _step response type' . $result->{type} );
248 }
249 return;
250}
25114µs1;
252
253__END__