← Index
NYTProf Performance Profile   « block view • line view • sub view »
For t/app_dpath.t
  Run on Tue Jun 5 15:25:28 2012
Reported on Tue Jun 5 15:26:06 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/File/Glob.pm
StatementsExecuted 35 statements in 6.66ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.81ms2.87msFile::Glob::::BEGIN@7File::Glob::BEGIN@7
11177µs93µsFile::Glob::::BEGIN@3File::Glob::BEGIN@3
11155µs1.11msFile::Glob::::importFile::Glob::import
11142µs90µsFile::Glob::::BEGIN@50File::Glob::BEGIN@50
11116µs16µsFile::Glob::::CORE:matchFile::Glob::CORE:match (opcode)
1116µs6µsFile::Glob::::GLOB_CSHFile::Glob::GLOB_CSH (xsub)
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
32255µs2109µs
# spent 93µs (77+16) within File::Glob::BEGIN@3 which was called: # once (77µs+16µs) by Config::General::BEGIN@22 at line 3
use strict;
# spent 93µs making 1 call to File::Glob::BEGIN@3 # spent 16µs making 1 call to strict::import
413µsour($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS, $DEFAULT_FLAGS);
5
612µsrequire XSLoader;
723.43ms22.92ms
# spent 2.87ms (2.81+56µs) within File::Glob::BEGIN@7 which was called: # once (2.81ms+56µs) by Config::General::BEGIN@22 at line 7
use feature 'switch';
# spent 2.87ms making 1 call to File::Glob::BEGIN@7 # spent 56µs making 1 call to feature::import
8
9127µ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
14119µs%EXPORT_TAGS = (
15 'glob' => [ qw(
16 GLOB_ABEND
17 GLOB_ALPHASORT
18 GLOB_ALTDIRFUNC
19 GLOB_BRACE
20 GLOB_CSH
21 GLOB_ERR
22 GLOB_ERROR
23 GLOB_LIMIT
24 GLOB_MARK
25 GLOB_NOCASE
26 GLOB_NOCHECK
27 GLOB_NOMAGIC
28 GLOB_NOSORT
29 GLOB_NOSPACE
30 GLOB_QUOTE
31 GLOB_TILDE
32 glob
33 bsd_glob
34 ) ],
35);
36
37116µs@EXPORT_OK = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob');
38
3912µs$VERSION = '1.12';
40
41
# spent 1.11ms (55µs+1.05) within File::Glob::import which was called: # once (55µs+1.05ms) by Config::General::BEGIN@22 at line 22 of Config/General.pm
sub import {
42332µs require Exporter;
43 local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
44 Exporter::import(grep {
4569µs11.05ms my $passthrough;
# spent 1.05ms making 1 call to Exporter::import
46814µs given ($_) {
47 $DEFAULT_FLAGS &= ~GLOB_NOCASE() when ':case';
48 $DEFAULT_FLAGS |= GLOB_NOCASE() when ':nocase';
49 when (':globally') {
5021.88ms2139µs
# spent 90µs (42+49) within File::Glob::BEGIN@50 which was called: # once (42µs+49µs) by Config::General::BEGIN@22 at line 50
no warnings 'redefine';
# spent 90µs making 1 call to File::Glob::BEGIN@50 # spent 48µs making 1 call to warnings::unimport
51 *CORE::GLOBAL::glob = \&File::Glob::csh_glob;
52 }
53 $passthrough = 1;
54 }
55 $passthrough;
56 } @_);
57}
58
591848µs1802µsXSLoader::load();
# spent 802µs making 1 call to XSLoader::load
60
61128µs16µs$DEFAULT_FLAGS = GLOB_CSH();
# spent 6µs making 1 call to File::Glob::GLOB_CSH
62134µs116µsif ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) {
# spent 16µs making 1 call to File::Glob::CORE:match
63 $DEFAULT_FLAGS |= GLOB_NOCASE();
64}
65
66# File::Glob::glob() is deprecated because its prototype is different from
67# CORE::glob() (use bsd_glob() instead)
68sub glob {
69 splice @_, 1; # don't pass PL_glob_index as flags!
70 goto &bsd_glob;
71}
72
73## borrowed heavily from gsar's File::DosGlob
7411µsmy %iter;
751600nsmy %entries;
76
77sub csh_glob {
78 my $pat = shift;
79 my $cxix = shift;
80 my @pat;
81
82 # glob without args defaults to $_
83 $pat = $_ unless defined $pat;
84
85 # extract patterns
86 $pat =~ s/^\s+//; # Protect against empty elements in
87 $pat =~ s/\s+$//; # things like < *.c> and <*.c >.
88 # These alone shouldn't trigger ParseWords.
89 if ($pat =~ /\s/) {
90 # XXX this is needed for compatibility with the csh
91 # implementation in Perl. Need to support a flag
92 # to disable this behavior.
93 require Text::ParseWords;
94 @pat = Text::ParseWords::parse_line('\s+',0,$pat);
95 }
96
97 # assume global context if not provided one
98 $cxix = '_G_' unless defined $cxix;
99 $iter{$cxix} = 0 unless exists $iter{$cxix};
100
101 # if we're just beginning, do it all first
102 if ($iter{$cxix} == 0) {
103 if (@pat) {
104 $entries{$cxix} = [ map { doglob($_, $DEFAULT_FLAGS) } @pat ];
105 }
106 else {
107 $entries{$cxix} = [ doglob($pat, $DEFAULT_FLAGS) ];
108 }
109 }
110
111 # chuck it all out, quick or slow
112 if (wantarray) {
113 delete $iter{$cxix};
114 return @{delete $entries{$cxix}};
115 }
116 else {
117 if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
118 return shift @{$entries{$cxix}};
119 }
120 else {
121 # return undef for EOL
122 delete $iter{$cxix};
123 delete $entries{$cxix};
124 return undef;
125 }
126 }
127}
128
129160µs1;
130__END__
 
# spent 16µs within File::Glob::CORE:match which was called: # once (16µs+0s) by Config::General::BEGIN@22 at line 62
sub File::Glob::CORE:match; # opcode
# spent 6µs within File::Glob::GLOB_CSH which was called: # once (6µs+0s) by Config::General::BEGIN@22 at line 61
sub File::Glob::GLOB_CSH; # xsub