← 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__