← 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:19 2013

Filename/usr/lib/perl/5.10/File/Glob.pm
StatementsExecuted 55 statements in 1.65ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
511264µs302µsFile::Glob::::AUTOLOADFile::Glob::AUTOLOAD
22251µs366µsFile::Glob::::GLOB_CSHFile::Glob::GLOB_CSH
51120µs20µsFile::Glob::::CORE:substFile::Glob::CORE:subst (opcode)
11118µs23µsFile::Glob::::BEGIN@3File::Glob::BEGIN@3
51118µs18µsFile::Glob::::constantFile::Glob::constant (xsub)
1119µs11µsFile::Glob::::importFile::Glob::import
2215µs5µsFile::Glob::::CORE:matchFile::Glob::CORE:match (opcode)
1114µs4µsFile::Glob::::BEGIN@7File::Glob::BEGIN@7
0000s0sFile::Glob::::GLOB_ERRORFile::Glob::GLOB_ERROR
0000s0sFile::Glob::::bsd_globFile::Glob::bsd_glob
0000s0sFile::Glob::::csh_globFile::Glob::csh_glob
0000s0sFile::Glob::::globFile::Glob::glob
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package File::Glob;
2
3363µs227µs
# spent 23µs (18+4) within File::Glob::BEGIN@3 which was called: # once (18µs+4µs) by File::GlobMapper::BEGIN@10 at line 3
use strict;
# spent 23µs making 1 call to File::Glob::BEGIN@3 # spent 4µs making 1 call to strict::import
411µsour($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS,
5 $AUTOLOAD, $DEFAULT_FLAGS);
6
73991µs14µs
# spent 4µs within File::Glob::BEGIN@7 which was called: # once (4µs+0s) by File::GlobMapper::BEGIN@10 at line 7
use XSLoader ();
# spent 4µs making 1 call to File::Glob::BEGIN@7
8
9110µs@ISA = qw(Exporter);
10
11# NOTE: The glob() export is only here for compatibility with 5.6.0.
12# csh_glob() should not be used directly, unless you know what you're doing.
13
1413µs@EXPORT_OK = qw(
15 csh_glob
16 bsd_glob
17 glob
18 GLOB_ABEND
19 GLOB_ALPHASORT
20 GLOB_ALTDIRFUNC
21 GLOB_BRACE
22 GLOB_CSH
23 GLOB_ERR
24 GLOB_ERROR
25 GLOB_LIMIT
26 GLOB_MARK
27 GLOB_NOCASE
28 GLOB_NOCHECK
29 GLOB_NOMAGIC
30 GLOB_NOSORT
31 GLOB_NOSPACE
32 GLOB_QUOTE
33 GLOB_TILDE
34);
35
3619µs%EXPORT_TAGS = (
37 'glob' => [ qw(
38 GLOB_ABEND
39 GLOB_ALPHASORT
40 GLOB_ALTDIRFUNC
41 GLOB_BRACE
42 GLOB_CSH
43 GLOB_ERR
44 GLOB_ERROR
45 GLOB_LIMIT
46 GLOB_MARK
47 GLOB_NOCASE
48 GLOB_NOCHECK
49 GLOB_NOMAGIC
50 GLOB_NOSORT
51 GLOB_NOSPACE
52 GLOB_QUOTE
53 GLOB_TILDE
54 glob
55 bsd_glob
56 ) ],
57);
58
591400ns$VERSION = '1.06';
60
61
# spent 11µs (9+2) within File::Glob::import which was called: # once (9µs+2µs) by File::GlobMapper::BEGIN@10 at line 19 of File/GlobMapper.pm
sub import {
621800ns require Exporter;
631400ns my $i = 1;
6411µs while ($i < @_) {
6515µs12µs if ($_[$i] =~ /^:(case|nocase|globally)$/) {
# spent 2µs making 1 call to File::Glob::CORE:match
66 splice(@_, $i, 1);
67 $DEFAULT_FLAGS &= ~GLOB_NOCASE() if $1 eq 'case';
68 $DEFAULT_FLAGS |= GLOB_NOCASE() if $1 eq 'nocase';
69 if ($1 eq 'globally') {
70 local $^W;
71 *CORE::GLOBAL::glob = \&File::Glob::csh_glob;
72 }
73 next;
74 }
7511µs ++$i;
76 }
7716µs1405µs goto &Exporter::import;
# spent 405µs making 1 call to Exporter::import
78}
79
80
# spent 302µs (264+38) within File::Glob::AUTOLOAD which was called 5 times, avg 60µs/call: # 5 times (264µs+38µs) by File::Glob::GLOB_CSH at line 105, avg 60µs/call
sub AUTOLOAD {
81 # This AUTOLOAD is used to 'autoload' constants from the constant()
82 # XS function. If a constant is not found then control is passed
83 # to the AUTOLOAD in AutoLoader.
84
8552µs my $constname;
86550µs520µs ($constname = $AUTOLOAD) =~ s/.*:://;
# spent 20µs making 5 calls to File::Glob::CORE:subst, avg 4µs/call
87540µs518µs my ($error, $val) = constant($constname);
# spent 18µs making 5 calls to File::Glob::constant, avg 4µs/call
8852µs if ($error) {
89 require Carp;
90 Carp::croak($error);
91 }
925183µs eval "sub $AUTOLOAD { $val }";
# spent 6µs executing statements in string eval
# includes 2µs spent executing 2 calls to 1 sub defined therein. # spent 6µs executing statements in string eval
# includes 3µs spent executing 2 calls to 1 sub defined therein. # spent 6µs executing statements in string eval
# includes 3µs spent executing 2 calls to 1 sub defined therein. # spent 5µs executing statements in string eval
# includes 3µs spent executing 2 calls to 1 sub defined therein. # spent 5µs executing statements in string eval
# includes 2µs spent executing 2 calls to 1 sub defined therein.
93536µs58µs goto &$AUTOLOAD;
# spent 2µs making 1 call to File::Glob::GLOB_BRACE # spent 2µs making 1 call to File::Glob::GLOB_NOMAGIC # spent 2µs making 1 call to File::Glob::GLOB_TILDE # spent 2µs making 1 call to File::Glob::GLOB_QUOTE # spent 2µs making 1 call to File::Glob::GLOB_ALPHASORT
94}
95
961195µs1187µsXSLoader::load 'File::Glob', $VERSION;
# spent 187µs making 1 call to XSLoader::load
97
98# Preloaded methods go here.
99
100sub GLOB_ERROR {
101 return (constant('GLOB_ERROR'))[1];
102}
103
104
# spent 366µs (51+315) within File::Glob::GLOB_CSH which was called 2 times, avg 183µs/call: # once (38µs+310µs) by File::GlobMapper::BEGIN@10 at line 112 # once (13µs+5µs) by File::GlobMapper::BEGIN@10 at line 20 of File/GlobMapper.pm
sub GLOB_CSH () {
105227µs10307µs GLOB_BRACE()
# spent 302µs making 5 calls to File::Glob::AUTOLOAD, avg 60µs/call # spent 1µs making 1 call to File::Glob::GLOB_BRACE # spent 1µs making 1 call to File::Glob::GLOB_NOMAGIC # spent 1µs making 1 call to File::Glob::GLOB_TILDE # spent 900ns making 1 call to File::Glob::GLOB_ALPHASORT # spent 900ns making 1 call to File::Glob::GLOB_QUOTE
106 | GLOB_NOMAGIC()
107 | GLOB_QUOTE()
108 | GLOB_TILDE()
109 | GLOB_ALPHASORT()
110}
111
11213µs1348µs$DEFAULT_FLAGS = GLOB_CSH();
# spent 348µs making 1 call to File::Glob::GLOB_CSH
11318µs14µsif ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos|MacOS)$/) {
# spent 4µs making 1 call to File::Glob::CORE:match
114 $DEFAULT_FLAGS |= GLOB_NOCASE();
115}
116
117# Autoload methods go after =cut, and are processed by the autosplit program.
118
119sub bsd_glob {
120 my ($pat,$flags) = @_;
121 $flags = $DEFAULT_FLAGS if @_ < 2;
122 return doglob($pat,$flags);
123}
124
125# File::Glob::glob() is deprecated because its prototype is different from
126# CORE::glob() (use bsd_glob() instead)
127sub glob {
128 splice @_, 1; # don't pass PL_glob_index as flags!
129 goto &bsd_glob;
130}
131
132## borrowed heavily from gsar's File::DosGlob
1331400nsmy %iter;
1341200nsmy %entries;
135
136sub csh_glob {
137 my $pat = shift;
138 my $cxix = shift;
139 my @pat;
140
141 # glob without args defaults to $_
142 $pat = $_ unless defined $pat;
143
144 # extract patterns
145 $pat =~ s/^\s+//; # Protect against empty elements in
146 $pat =~ s/\s+$//; # things like < *.c> and <*.c >.
147 # These alone shouldn't trigger ParseWords.
148 if ($pat =~ /\s/) {
149 # XXX this is needed for compatibility with the csh
150 # implementation in Perl. Need to support a flag
151 # to disable this behavior.
152 require Text::ParseWords;
153 @pat = Text::ParseWords::parse_line('\s+',0,$pat);
154 }
155
156 # assume global context if not provided one
157 $cxix = '_G_' unless defined $cxix;
158 $iter{$cxix} = 0 unless exists $iter{$cxix};
159
160 # if we're just beginning, do it all first
161 if ($iter{$cxix} == 0) {
162 if (@pat) {
163 $entries{$cxix} = [ map { doglob($_, $DEFAULT_FLAGS) } @pat ];
164 }
165 else {
166 $entries{$cxix} = [ doglob($pat, $DEFAULT_FLAGS) ];
167 }
168 }
169
170 # chuck it all out, quick or slow
171 if (wantarray) {
172 delete $iter{$cxix};
173 return @{delete $entries{$cxix}};
174 }
175 else {
176 if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
177 return shift @{$entries{$cxix}};
178 }
179 else {
180 # return undef for EOL
181 delete $iter{$cxix};
182 delete $entries{$cxix};
183 return undef;
184 }
185 }
186}
187
188113µs1;
189__END__
 
# spent 5µs within File::Glob::CORE:match which was called 2 times, avg 3µs/call: # once (4µs+0s) by File::GlobMapper::BEGIN@10 at line 113 # once (2µs+0s) by File::Glob::import at line 65
sub File::Glob::CORE:match; # opcode
# spent 20µs within File::Glob::CORE:subst which was called 5 times, avg 4µs/call: # 5 times (20µs+0s) by File::Glob::AUTOLOAD at line 86, avg 4µs/call
sub File::Glob::CORE:subst; # opcode
# spent 18µs within File::Glob::constant which was called 5 times, avg 4µs/call: # 5 times (18µs+0s) by File::Glob::AUTOLOAD at line 87, avg 4µs/call
sub File::Glob::constant; # xsub