← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/getfix
  Run on Thu May 20 15:30:03 2010
Reported on Thu May 20 16:25:47 2010

File/opt/wise/lib/perl5/5.10.0/x86_64-linux-thread-multi/lib.pm
Statements Executed1049
Total Time0.005257 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2222220.003700.00458lib::import
44110.000560.00056lib::_get_dirs
44110.000320.00032lib::_nativize
00000lib::BEGIN
00000lib::unimport

LineStmts.Exclusive
Time
Avg.Code
1package lib;
2
3# THIS FILE IS AUTOMATICALLY GENERATED FROM lib_pm.PL.
4# ANY CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE NEXT PERL BUILD.
5
630.000186.1e-5use Config;
# spent 31µs making 1 call to Config::import
7
830.000590.00020use strict;
# spent 7µs making 1 call to strict::import
9
1011.7e-51.7e-5my $archname = $Config{archname};
# spent 14µs making 1 call to Config::FETCH
1119.0e-69.0e-6my $version = $Config{version};
# spent 7µs making 1 call to Config::FETCH
1211.1e-51.1e-5my @inc_version_list = reverse split / /, $Config{inc_version_list};
# spent 7µs making 1 call to Config::FETCH
13
14
1514.0e-64.0e-6our @ORIG_INC = @INC; # take a handy copy of 'original' value
1611.0e-61.0e-6our $VERSION = '0.5565';
1712.0e-62.0e-6my $Is_MacOS = $^O eq 'MacOS';
1811.0e-61.0e-6my $Mac_FS;
19100if ($Is_MacOS) {
20 require File::Spec;
21 $Mac_FS = eval { require Mac::FileSpec::Unixish };
22}
23
24
# spent 4.58ms (3.70+881µs) within lib::import which was called 22 times, avg 208µs/call: # once (854µs+58µs) at line 1 of (eval 1)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (464µs+18µs) at line 1 of (eval 2)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (221µs+80µs) at line 1 of (eval 8)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (186µs+64µs) at line 1 of (eval 37)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (169µs+75µs) at line 1 of (eval 26)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (178µs+61µs) at line 1 of (eval 17)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (164µs+58µs) at line 1 of (eval 65)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (165µs+54µs) at line 1 of (eval 34)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (157µs+61µs) at line 1 of (eval 200)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (146µs+66µs) at line 1 of (eval 14)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (150µs+60µs) at line 1 of (eval 28)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (131µs+52µs) at line 1 of (eval 5)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:61] at line 61 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (80µs+18µs) at line 1 of (eval 9)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (79µs+17µs) at line 1 of (eval 18)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (77µs+17µs) at line 1 of (eval 35)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (73µs+16µs) at line 1 of (eval 38)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (68µs+19µs) at line 1 of (eval 15)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (68µs+19µs) by WISE::Env::BEGIN at line 1 of (eval 201)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (69µs+17µs) at line 1 of (eval 29)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (69µs+17µs) at line 1 of (eval 66)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (67µs+17µs) at line 1 of (eval 6)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm # once (66µs+17µs) at line 1 of (eval 27)[/wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm:64] at line 64 of /wise/base/static/lib/perl5/site_perl/5.10.0/WISE/Env.pm
sub import {
25221.4e-56.4e-7 shift;
26
27221.2e-55.5e-7 my %names;
28224.6e-52.1e-6 foreach (reverse @_) {
29445.3e-51.2e-6 my $path = $_; # we'll be modifying it, so break the alias
30442.6e-55.9e-7 if ($path eq '') {
31 require Carp;
32 Carp::carp("Empty compile time value given to use lib");
33 }
34
35440.000235.2e-6 $path = _nativize($path);
# spent 325µs making 44 calls to lib::_nativize, avg 7µs/call
36
37440.001092.5e-5 if (-e $path && ! -d _) {
38 require Carp;
39 Carp::carp("Parameter to use lib must be directory, not file");
40 }
41448.2e-51.9e-6 unshift(@INC, $path);
42 # Add any previous version directories we found at configure time
43447.7e-51.7e-6 foreach my $incver (@inc_version_list)
44 {
45 my $dir = $Is_MacOS
46 ? File::Spec->catdir( $path, $incver )
47 : "$path/$incver";
48 unshift(@INC, $dir) if -d $dir;
49 }
50 # Put a corresponding archlib directory in front of $path if it
51 # looks like $path has an archlib directory below it.
52440.000317.0e-6 my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir)
# spent 556µs making 44 calls to lib::_get_dirs, avg 13µs/call
53 = _get_dirs($path);
54440.000691.6e-5 unshift(@INC, $arch_dir) if -d $arch_auto_dir;
55440.000265.9e-6 unshift(@INC, $version_dir) if -d $version_dir;
56440.000327.3e-6 unshift(@INC, $version_arch_dir) if -d $version_arch_dir;
57 }
58
59 # remove trailing duplicates
60220.000512.3e-5 @INC = grep { ++$names{$_} == 1 } @INC;
61227.7e-53.5e-6 return;
62}
63
64
65sub unimport {
66 shift;
67
68 my %names;
69 foreach (@_) {
70 my $path = _nativize($_);
71
72 my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir)
73 = _get_dirs($path);
74 ++$names{$path};
75 ++$names{$arch_dir} if -d $arch_auto_dir;
76 ++$names{$version_dir} if -d $version_dir;
77 ++$names{$version_arch_dir} if -d $version_arch_dir;
78 }
79
80 # Remove ALL instances of each named directory.
81 @INC = grep { !exists $names{$_} } @INC;
82 return;
83}
84
85
# spent 556µs within lib::_get_dirs which was called 44 times, avg 13µs/call: # 44 times (556µs+0) by lib::import at line 52, avg 13µs/call
sub _get_dirs {
86446.1e-51.4e-6 my($dir) = @_;
87442.9e-56.6e-7 my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir);
88
89 # we could use this for all platforms in the future, but leave it
90 # Mac-only for now, until there is more time for testing it.
91445.2e-51.2e-6 if ($Is_MacOS) {
92 $arch_auto_dir = File::Spec->catdir( $dir, $archname, 'auto' );
93 $arch_dir = File::Spec->catdir( $dir, $archname, );
94 $version_dir = File::Spec->catdir( $dir, $version );
95 $version_arch_dir = File::Spec->catdir( $dir, $version, $archname );
96 } else {
97445.5e-51.2e-6 $arch_auto_dir = "$dir/$archname/auto";
98443.6e-58.2e-7 $arch_dir = "$dir/$archname";
99442.8e-56.4e-7 $version_dir = "$dir/$version";
100444.6e-51.0e-6 $version_arch_dir = "$dir/$version/$archname";
101 }
102440.000122.7e-6 return($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir);
103}
104
105
# spent 325µs within lib::_nativize which was called 44 times, avg 7µs/call: # 44 times (325µs+0) by lib::import at line 35, avg 7µs/call
sub _nativize {
106447.7e-51.7e-6 my($dir) = @_;
107
108442.1e-54.8e-7 if ($Is_MacOS && $Mac_FS && ! -d $dir) {
109 $dir = Mac::FileSpec::Unixish::nativize($dir);
110 $dir .= ":" unless $dir =~ /:$/;
111 }
112
113440.000102.3e-6 return $dir;
114}
115
11611.1e-51.1e-51;
117__END__
118
119=head1 NAME
120
121lib - manipulate @INC at compile time
122
123=head1 SYNOPSIS
124
125 use lib LIST;
126
127 no lib LIST;
128
129=head1 DESCRIPTION
130
131This is a small simple module which simplifies the manipulation of @INC
132at compile time.
133
134It is typically used to add extra directories to perl's search path so
135that later C<use> or C<require> statements will find modules which are
136not located on perl's default search path.
137
138=head2 Adding directories to @INC
139
140The parameters to C<use lib> are added to the start of the perl search
141path. Saying
142
143 use lib LIST;
144
145is I<almost> the same as saying
146
147 BEGIN { unshift(@INC, LIST) }
148
149For each directory in LIST (called $dir here) the lib module also
150checks to see if a directory called $dir/$archname/auto exists.
151If so the $dir/$archname directory is assumed to be a corresponding
152architecture specific directory and is added to @INC in front of $dir.
153
154The current value of C<$archname> can be found with this command:
155
156 perl -V:archname
157
158To avoid memory leaks, all trailing duplicate entries in @INC are
159removed.
160
161=head2 Deleting directories from @INC
162
163You should normally only add directories to @INC. If you need to
164delete directories from @INC take care to only delete those which you
165added yourself or which you are certain are not needed by other modules
166in your script. Other modules may have added directories which they
167need for correct operation.
168
169The C<no lib> statement deletes all instances of each named directory
170from @INC.
171
172For each directory in LIST (called $dir here) the lib module also
173checks to see if a directory called $dir/$archname/auto exists.
174If so the $dir/$archname directory is assumed to be a corresponding
175architecture specific directory and is also deleted from @INC.
176
177=head2 Restoring original @INC
178
179When the lib module is first loaded it records the current value of @INC
180in an array C<@lib::ORIG_INC>. To restore @INC to that value you
181can say
182
183 @INC = @lib::ORIG_INC;
184
185=head1 CAVEATS
186
187In order to keep lib.pm small and simple, it only works with Unix
188filepaths. This doesn't mean it only works on Unix, but non-Unix
189users must first translate their file paths to Unix conventions.
190
191 # VMS users wanting to put [.stuff.moo] into
192 # their @INC would write
193 use lib 'stuff/moo';
194
195=head1 NOTES
196
197In the future, this module will likely use File::Spec for determining
198paths, as it does now for Mac OS (where Unix-style or Mac-style paths
199work, and Unix-style paths are converted properly to Mac-style paths
200before being added to @INC).
201
202=head1 SEE ALSO
203
204FindBin - optional module which deals with paths relative to the source file.
205
206=head1 AUTHOR
207
208Tim Bunce, 2nd June 1995.
209
210=cut