← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:49 2015

Filename/usr/share/perl5/Class/Factory/Util.pm
StatementsExecuted 88 statements in 7.77ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11113.38ms3.38msClass::Factory::Util::::CORE:ftfileClass::Factory::Util::CORE:ftfile (opcode)
22112.02ms2.02msClass::Factory::Util::::CORE:ftdirClass::Factory::Util::CORE:ftdir (opcode)
3111.02ms1.02msClass::Factory::Util::::CORE:open_dirClass::Factory::Util::CORE:open_dir (opcode)
311611µs611µsClass::Factory::Util::::CORE:readdirClass::Factory::Util::CORE:readdir (opcode)
2211186µs7.25msClass::Factory::Util::::_scandirClass::Factory::Util::_scandir
222109µs7.37msClass::Factory::Util::::_subclassesClass::Factory::Util::_subclasses
31124µs24µsClass::Factory::Util::::CORE:closedirClass::Factory::Util::CORE:closedir (opcode)
11116µs23µsClass::Factory::Util::::BEGIN@17Class::Factory::Util::BEGIN@17
11111µs22µsClass::Factory::Util::::BEGIN@3Class::Factory::Util::BEGIN@3
22211µs11µsClass::Factory::Util::::importClass::Factory::Util::import
11110µs31µsClass::Factory::Util::::BEGIN@6Class::Factory::Util::BEGIN@6
1116µs24µsClass::Factory::Util::::BEGIN@4Class::Factory::Util::BEGIN@4
2115µs5µsClass::Factory::Util::::CORE:substClass::Factory::Util::CORE:subst (opcode)
2115µs5µsClass::Factory::Util::::CORE:sortClass::Factory::Util::CORE:sort (opcode)
0000s0sClass::Factory::Util::::subclassesClass::Factory::Util::subclasses
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::Factory::Util;
2
3230µs234µs
# spent 22µs (11+11) within Class::Factory::Util::BEGIN@3 which was called: # once (11µs+11µs) by DateTime::Format::Builder::Parser::BEGIN@375 at line 3
use strict;
# spent 22µs making 1 call to Class::Factory::Util::BEGIN@3 # spent 11µs making 1 call to strict::import
4223µs242µs
# spent 24µs (6+18) within Class::Factory::Util::BEGIN@4 which was called: # once (6µs+18µs) by DateTime::Format::Builder::Parser::BEGIN@375 at line 4
use vars qw($VERSION);
# spent 24µs making 1 call to Class::Factory::Util::BEGIN@4 # spent 18µs making 1 call to vars::import
5
6246µs252µs
# spent 31µs (10+21) within Class::Factory::Util::BEGIN@6 which was called: # once (10µs+21µs) by DateTime::Format::Builder::Parser::BEGIN@375 at line 6
use Carp qw(confess);
# spent 31µs making 1 call to Class::Factory::Util::BEGIN@6 # spent 21µs making 1 call to Exporter::import
7
81400ns$VERSION = '1.7';
9
1012µs1;
11
12sub import
13
# spent 11µs within Class::Factory::Util::import which was called 2 times, avg 5µs/call: # once (6µs+0s) by C4::ClassSortRoutine::BEGIN@24 at line 24 of C4/ClassSortRoutine.pm # once (5µs+0s) by DateTime::Format::Builder::Parser::BEGIN@375 at line 375 of DateTime/Format/Builder/Parser.pm
{
1422µs my $caller = caller(0);
15
16 {
174292µs231µs
# spent 23µs (16+8) within Class::Factory::Util::BEGIN@17 which was called: # once (16µs+8µs) by DateTime::Format::Builder::Parser::BEGIN@375 at line 17
no strict 'refs';
# spent 23µs making 1 call to Class::Factory::Util::BEGIN@17 # spent 8µs making 1 call to strict::unimport
1827µs *{"${caller}::subclasses"} = \&_subclasses;
19 }
20}
21
22# deprecated
23sub subclasses { _subclasses(@_) }
24
25sub _subclasses
26
# spent 7.37ms (109µs+7.26) within Class::Factory::Util::_subclasses which was called 2 times, avg 3.68ms/call: # once (54µs+6.60ms) by C4::ClassSortRoutine::GetSortRoutineNames at line 80 of C4/ClassSortRoutine.pm # once (54µs+659µs) by DateTime::Format::MySQL::BEGIN@11 at line 377 of DateTime/Format/Builder/Parser.pm
{
272900ns my $base = shift;
28
29214µs25µs $base =~ s,::,/,g;
# spent 5µs making 2 calls to Class::Factory::Util::CORE:subst, avg 3µs/call
30
31216µs my %dirs = map { $_ => 1 } @INC;
32
3326µs my $dir = substr( $INC{"$base.pm"}, 0, (length $INC{"$base.pm"}) - 3 );
34
3522µs $dirs{$dir} = 1;
36
37240µs227.25ms my @packages = map { _scandir( "$_/$base" ) } keys %dirs;
# spent 7.25ms making 22 calls to Class::Factory::Util::_scandir, avg 329µs/call
38
39 # Make list of unique elements
4029µs my %packages = map { $_ => 1 } @packages;
41
42225µs25µs return sort keys %packages;
# spent 5µs making 2 calls to Class::Factory::Util::CORE:sort, avg 2µs/call
43}
44
45sub _scandir
46
# spent 7.25ms (186µs+7.06) within Class::Factory::Util::_scandir which was called 22 times, avg 329µs/call: # 22 times (186µs+7.06ms) by Class::Factory::Util::_subclasses at line 37, avg 329µs/call
{
47224µs my $dir = shift;
48
49222.10ms222.02ms return unless -d $dir;
# spent 2.02ms making 22 calls to Class::Factory::Util::CORE:ftdir, avg 92µs/call
50
5131.04ms31.02ms opendir DIR, $dir
# spent 1.02ms making 3 calls to Class::Factory::Util::CORE:open_dir, avg 340µs/call
52 or confess ("Cannot open directory $dir: $!");
53
54 my @packages =
55 ( map { substr($_, 0, length($_) - 3) }
5634.08ms144.00ms grep { substr($_, -3) eq '.pm' && -f "$dir/$_" }
# spent 3.38ms making 11 calls to Class::Factory::Util::CORE:ftfile, avg 308µs/call # spent 611µs making 3 calls to Class::Factory::Util::CORE:readdir, avg 204µs/call
57 readdir DIR
58 );
59
60333µs324µs closedir DIR
# spent 24µs making 3 calls to Class::Factory::Util::CORE:closedir, avg 8µs/call
61 or confess("Cannot close directory $dir: $!" );
62
6338µs return @packages;
64}
65
66__END__
 
# spent 24µs within Class::Factory::Util::CORE:closedir which was called 3 times, avg 8µs/call: # 3 times (24µs+0s) by Class::Factory::Util::_scandir at line 60, avg 8µs/call
sub Class::Factory::Util::CORE:closedir; # opcode
# spent 2.02ms within Class::Factory::Util::CORE:ftdir which was called 22 times, avg 92µs/call: # 22 times (2.02ms+0s) by Class::Factory::Util::_scandir at line 49, avg 92µs/call
sub Class::Factory::Util::CORE:ftdir; # opcode
# spent 3.38ms within Class::Factory::Util::CORE:ftfile which was called 11 times, avg 308µs/call: # 11 times (3.38ms+0s) by Class::Factory::Util::_scandir at line 56, avg 308µs/call
sub Class::Factory::Util::CORE:ftfile; # opcode
# spent 1.02ms within Class::Factory::Util::CORE:open_dir which was called 3 times, avg 340µs/call: # 3 times (1.02ms+0s) by Class::Factory::Util::_scandir at line 51, avg 340µs/call
sub Class::Factory::Util::CORE:open_dir; # opcode
# spent 611µs within Class::Factory::Util::CORE:readdir which was called 3 times, avg 204µs/call: # 3 times (611µs+0s) by Class::Factory::Util::_scandir at line 56, avg 204µs/call
sub Class::Factory::Util::CORE:readdir; # opcode
# spent 5µs within Class::Factory::Util::CORE:sort which was called 2 times, avg 2µs/call: # 2 times (5µs+0s) by Class::Factory::Util::_subclasses at line 42, avg 2µs/call
sub Class::Factory::Util::CORE:sort; # opcode
# spent 5µs within Class::Factory::Util::CORE:subst which was called 2 times, avg 3µs/call: # 2 times (5µs+0s) by Class::Factory::Util::_subclasses at line 29, avg 3µs/call
sub Class::Factory::Util::CORE:subst; # opcode