← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/hailo
  Run on Thu Oct 21 22:50:37 2010
Reported on Thu Oct 21 22:52:05 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/5.13.5/x86_64-linux/File/Glob.pm
StatementsExecuted 46 statements in 1.20ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
511200µs223µsFile::Glob::::AUTOLOADFile::Glob::AUTOLOAD
11146µs283µsFile::Glob::::GLOB_CSHFile::Glob::GLOB_CSH
11125µs31µsFile::Glob::::BEGIN@3File::Glob::BEGIN@3
51114µs14µsFile::Glob::::CORE:substFile::Glob::CORE:subst (opcode)
5119µs9µsFile::Glob::::constantFile::Glob::constant (xsub)
1116µs6µsFile::Glob::::BEGIN@7File::Glob::BEGIN@7
1114µs4µsFile::Glob::::CORE:matchFile::Glob::CORE:match (opcode)
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
0000s0sFile::Glob::::importFile::Glob::import
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
3261µs237µs
# spent 31µs (25+6) within File::Glob::BEGIN@3 which was called: # once (25µs+6µs) by Hailo::Command::BEGIN@374 at line 3
use strict;
# spent 31µs making 1 call to File::Glob::BEGIN@3 # spent 6µs making 1 call to strict::import
411µsour($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS,
5 $AUTOLOAD, $DEFAULT_FLAGS);
6
72624µs16µs
# spent 6µs within File::Glob::BEGIN@7 which was called: # once (6µs+0s) by Hailo::Command::BEGIN@374 at line 7
use XSLoader ();
# spent 6µs making 1 call to File::Glob::BEGIN@7
8
916µ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
1414µ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
3615µ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
591800ns$VERSION = '1.08';
60
61sub import {
62 require Exporter;
63 my $i = 1;
64 while ($i < @_) {
65 if ($_[$i] =~ /^:(case|nocase|globally)$/) {
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 }
75 ++$i;
76 }
77 goto &Exporter::import;
78}
79
80
# spent 223µs (200+23) within File::Glob::AUTOLOAD which was called 5 times, avg 45µs/call: # 5 times (200µs+23µs) by File::Glob::GLOB_CSH at line 105, avg 45µ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
8530234µs my $constname;
86514µs ($constname = $AUTOLOAD) =~ s/.*:://;
# spent 14µs making 5 calls to File::Glob::CORE:subst, avg 3µs/call
8759µs my ($error, $val) = constant($constname);
# spent 9µs making 5 calls to File::Glob::constant, avg 2µs/call
88 if ($error) {
89 require Carp;
90 Carp::croak($error);
91 }
92 eval "sub $AUTOLOAD { $val }";
# spent 5µs executing statements in string eval
# includes 3µs spent executing 1 call to 1 sub defined therein. # spent 5µs executing statements in string eval
# includes 3µs spent executing 1 call to 1 sub defined therein. # spent 5µs executing statements in string eval
# includes 3µs spent executing 1 call to 1 sub defined therein. # spent 4µs executing statements in string eval
# includes 3µs spent executing 1 call to 1 sub defined therein. # spent 4µs executing statements in string eval
# includes 3µs spent executing 1 call to 1 sub defined therein.
93514µs goto &$AUTOLOAD;
# spent 3µs making 1 call to File::Glob::GLOB_BRACE # spent 3µs making 1 call to File::Glob::GLOB_QUOTE # spent 3µs making 1 call to File::Glob::GLOB_ALPHASORT # spent 3µs making 1 call to File::Glob::GLOB_NOMAGIC # spent 3µs making 1 call to File::Glob::GLOB_TILDE
94}
95
961209µs1202µsXSLoader::load 'File::Glob', $VERSION;
# spent 202µ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 283µs (46+237) within File::Glob::GLOB_CSH which was called: # once (46µs+237µs) by Hailo::Command::BEGIN@374 at line 112
sub GLOB_CSH () {
105127µs5223µs GLOB_BRACE()
# spent 223µs making 5 calls to File::Glob::AUTOLOAD, avg 45µs/call
106 | GLOB_NOMAGIC()
107 | GLOB_QUOTE()
108 | GLOB_TILDE()
109 | GLOB_ALPHASORT()
110}
111
11214µs1283µs$DEFAULT_FLAGS = GLOB_CSH();
# spent 283µs making 1 call to File::Glob::GLOB_CSH
11319µs14µsif ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) {
# 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
1331700nsmy %iter;
13411µsmy %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
188112µs1;
189__END__
 
# spent 4µs within File::Glob::CORE:match which was called: # once (4µs+0s) by Hailo::Command::BEGIN@374 at line 113
sub File::Glob::CORE:match; # opcode
# spent 14µs within File::Glob::CORE:subst which was called 5 times, avg 3µs/call: # 5 times (14µs+0s) by File::Glob::AUTOLOAD at line 86, avg 3µs/call
sub File::Glob::CORE:subst; # opcode
# spent 9µs within File::Glob::constant which was called 5 times, avg 2µs/call: # 5 times (9µs+0s) by File::Glob::AUTOLOAD at line 87, avg 2µs/call
sub File::Glob::constant; # xsub