← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:39 2013

Filename/usr/share/perl5/Class/Factory/Util.pm
StatementsExecuted 88 statements in 1.24ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2211189µs411µsClass::Factory::Util::::_scandirClass::Factory::Util::_scandir
222188µs626µsClass::Factory::Util::::_subclassesClass::Factory::Util::_subclasses
221194µs94µsClass::Factory::Util::::CORE:ftdirClass::Factory::Util::CORE:ftdir (opcode)
21146µs46µsClass::Factory::Util::::CORE:open_dirClass::Factory::Util::CORE:open_dir (opcode)
21142µs42µsClass::Factory::Util::::CORE:readdirClass::Factory::Util::CORE:readdir (opcode)
11130µs40µsClass::Factory::Util::::BEGIN@3Class::Factory::Util::BEGIN@3
81124µs24µsClass::Factory::Util::::CORE:ftfileClass::Factory::Util::CORE:ftfile (opcode)
22223µs23µsClass::Factory::Util::::importClass::Factory::Util::import
21116µs16µsClass::Factory::Util::::CORE:closedirClass::Factory::Util::CORE:closedir (opcode)
11115µs74µsClass::Factory::Util::::BEGIN@6Class::Factory::Util::BEGIN@6
21114µs14µsClass::Factory::Util::::CORE:substClass::Factory::Util::CORE:subst (opcode)
21113µs13µsClass::Factory::Util::::CORE:sortClass::Factory::Util::CORE:sort (opcode)
11113µs33µsClass::Factory::Util::::BEGIN@17Class::Factory::Util::BEGIN@17
11111µs51µsClass::Factory::Util::::BEGIN@4Class::Factory::Util::BEGIN@4
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
33120µs250µs
# spent 40µs (30+10) within Class::Factory::Util::BEGIN@3 which was called: # once (30µs+10µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 3
use strict;
# spent 40µs making 1 call to Class::Factory::Util::BEGIN@3 # spent 10µs making 1 call to strict::import
4333µs290µs
# spent 51µs (11+39) within Class::Factory::Util::BEGIN@4 which was called: # once (11µs+39µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 4
use vars qw($VERSION);
# spent 51µs making 1 call to Class::Factory::Util::BEGIN@4 # spent 39µs making 1 call to vars::import
5
6372µs2132µs
# spent 74µs (15+58) within Class::Factory::Util::BEGIN@6 which was called: # once (15µs+58µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 6
use Carp qw(confess);
# spent 74µs making 1 call to Class::Factory::Util::BEGIN@6 # spent 58µs making 1 call to Exporter::import
7
81800ns$VERSION = '1.7';
9
1014µs1;
11
12sub import
13
# spent 23µs within Class::Factory::Util::import which was called 2 times, avg 12µs/call: # once (12µs+0s) by DateTime::Format::Builder::Parser::BEGIN@626 at line 626 of DateTime/Format/Builder/Parser.pm # once (11µs+0s) by C4::ClassSortRoutine::BEGIN@24 at line 24 of /usr/share/koha/lib/C4/ClassSortRoutine.pm
{
1423µs my $caller = caller(0);
15
16 {
175362µs253µs
# spent 33µs (13+20) within Class::Factory::Util::BEGIN@17 which was called: # once (13µs+20µs) by DateTime::Format::Builder::Parser::BEGIN@626 at line 17
no strict 'refs';
# spent 33µs making 1 call to Class::Factory::Util::BEGIN@17 # spent 20µs making 1 call to strict::unimport
18215µs *{"${caller}::subclasses"} = \&_subclasses;
19 }
20}
21
22# deprecated
23sub subclasses { _subclasses(@_) }
24
25sub _subclasses
26
# spent 626µs (188+438) within Class::Factory::Util::_subclasses which was called 2 times, avg 313µs/call: # once (107µs+252µs) by DateTime::Format::MySQL::BEGIN@11 at line 628 of DateTime/Format/Builder/Parser.pm # once (81µs+186µs) by C4::ClassSortRoutine::GetSortRoutineNames at line 80 of /usr/share/koha/lib/C4/ClassSortRoutine.pm
{
2722µs my $base = shift;
28
29238µs214µs $base =~ s,::,/,g;
# spent 14µs making 2 calls to Class::Factory::Util::CORE:subst, avg 7µs/call
30
31235µs my %dirs = map { $_ => 1 } @INC;
32
33213µs my $dir = substr( $INC{"$base.pm"}, 0, (length $INC{"$base.pm"}) - 3 );
34
3522µs $dirs{$dir} = 1;
36
37267µs22411µs my @packages = map { _scandir( "$_/$base" ) } keys %dirs;
# spent 411µs making 22 calls to Class::Factory::Util::_scandir, avg 19µs/call
38
39 # Make list of unique elements
40212µs my %packages = map { $_ => 1 } @packages;
41
42238µs213µs return sort keys %packages;
# spent 13µs making 2 calls to Class::Factory::Util::CORE:sort, avg 6µs/call
43}
44
45sub _scandir
46
# spent 411µs (189+222) within Class::Factory::Util::_scandir which was called 22 times, avg 19µs/call: # 22 times (189µs+222µs) by Class::Factory::Util::_subclasses at line 37, avg 19µs/call
{
472214µs my $dir = shift;
48
4922197µs2294µs return unless -d $dir;
# spent 94µs making 22 calls to Class::Factory::Util::CORE:ftdir, avg 4µs/call
50
51258µs246µs opendir DIR, $dir
# spent 46µs making 2 calls to Class::Factory::Util::CORE:open_dir, avg 23µs/call
52 or confess ("Cannot open directory $dir: $!");
53
54 my @packages =
55 ( map { substr($_, 0, length($_) - 3) }
562114µs1066µs grep { substr($_, -3) eq '.pm' && -f "$dir/$_" }
# spent 42µs making 2 calls to Class::Factory::Util::CORE:readdir, avg 21µs/call # spent 24µs making 8 calls to Class::Factory::Util::CORE:ftfile, avg 3µs/call
57 readdir DIR
58 );
59
60227µs216µs closedir DIR
# spent 16µs making 2 calls to Class::Factory::Util::CORE:closedir, avg 8µs/call
61 or confess("Cannot close directory $dir: $!" );
62
63212µs return @packages;
64}
65
66__END__
 
# spent 16µs within Class::Factory::Util::CORE:closedir which was called 2 times, avg 8µs/call: # 2 times (16µs+0s) by Class::Factory::Util::_scandir at line 60, avg 8µs/call
sub Class::Factory::Util::CORE:closedir; # opcode
# spent 94µs within Class::Factory::Util::CORE:ftdir which was called 22 times, avg 4µs/call: # 22 times (94µs+0s) by Class::Factory::Util::_scandir at line 49, avg 4µs/call
sub Class::Factory::Util::CORE:ftdir; # opcode
# spent 24µs within Class::Factory::Util::CORE:ftfile which was called 8 times, avg 3µs/call: # 8 times (24µs+0s) by Class::Factory::Util::_scandir at line 56, avg 3µs/call
sub Class::Factory::Util::CORE:ftfile; # opcode
# spent 46µs within Class::Factory::Util::CORE:open_dir which was called 2 times, avg 23µs/call: # 2 times (46µs+0s) by Class::Factory::Util::_scandir at line 51, avg 23µs/call
sub Class::Factory::Util::CORE:open_dir; # opcode
# spent 42µs within Class::Factory::Util::CORE:readdir which was called 2 times, avg 21µs/call: # 2 times (42µs+0s) by Class::Factory::Util::_scandir at line 56, avg 21µs/call
sub Class::Factory::Util::CORE:readdir; # opcode
# spent 13µs within Class::Factory::Util::CORE:sort which was called 2 times, avg 6µs/call: # 2 times (13µs+0s) by Class::Factory::Util::_subclasses at line 42, avg 6µs/call
sub Class::Factory::Util::CORE:sort; # opcode
# spent 14µs within Class::Factory::Util::CORE:subst which was called 2 times, avg 7µs/call: # 2 times (14µs+0s) by Class::Factory::Util::_subclasses at line 29, avg 7µs/call
sub Class::Factory::Util::CORE:subst; # opcode