| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/5.18.0/darwin-thread-multi-2level/lib.pm |
| Statements | Executed 68 statements in 558µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 551µs | 1.28ms | lib::BEGIN@6 |
| 2 | 2 | 2 | 72µs | 117µs | lib::import |
| 3 | 1 | 1 | 16µs | 16µs | lib::_get_dirs |
| 3 | 1 | 1 | 13µs | 13µs | lib::CORE:ftis (opcode) |
| 12 | 4 | 1 | 13µs | 13µs | lib::CORE:ftdir (opcode) |
| 1 | 1 | 1 | 5µs | 15µs | lib::BEGIN@8 |
| 3 | 1 | 1 | 3µs | 3µs | lib::CORE:match (opcode) |
| 0 | 0 | 0 | 0s | 0s | lib::unimport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package 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 | |||||
| 6 | 2 | 88µs | 2 | 1.29ms | # spent 1.28ms (551µs+732µs) within lib::BEGIN@6 which was called:
# once (551µs+732µs) by main::BEGIN@2 at line 6 # spent 1.28ms making 1 call to lib::BEGIN@6
# spent 8µs making 1 call to Config::import |
| 7 | |||||
| 8 | 2 | 341µs | 2 | 24µs | # spent 15µs (5+10) within lib::BEGIN@8 which was called:
# once (5µs+10µs) by main::BEGIN@2 at line 8 # spent 15µs making 1 call to lib::BEGIN@8
# spent 10µs making 1 call to strict::import |
| 9 | |||||
| 10 | 1 | 5µs | 1 | 3µs | my $archname = $Config{archname}; # spent 3µs making 1 call to Config::FETCH |
| 11 | 1 | 3µs | 1 | 2µs | my $version = $Config{version}; # spent 2µs making 1 call to Config::FETCH |
| 12 | 1 | 3µs | 1 | 2µs | my @inc_version_list = reverse split / /, $Config{inc_version_list}; # spent 2µs making 1 call to Config::FETCH |
| 13 | |||||
| 14 | |||||
| 15 | 1 | 1µs | our @ORIG_INC = @INC; # take a handy copy of 'original' value | ||
| 16 | 1 | 200ns | our $VERSION = '0.63'; | ||
| 17 | |||||
| 18 | # spent 117µs (72+45) within lib::import which was called 2 times, avg 58µs/call:
# once (41µs+28µs) by Atom::BEGIN@4 at line 4 of lib/HackaMol/Atom.pm
# once (31µs+17µs) by main::BEGIN@2 at line 2 of examples/Atom-timer.pl | ||||
| 19 | 2 | 300ns | shift; | ||
| 20 | |||||
| 21 | 2 | 300ns | my %names; | ||
| 22 | 2 | 2µs | foreach (reverse @_) { | ||
| 23 | 3 | 1µs | my $path = $_; # we'll be modifying it, so break the alias | ||
| 24 | 3 | 900ns | if ($path eq '') { | ||
| 25 | require Carp; | ||||
| 26 | Carp::carp("Empty compile time value given to use lib"); | ||||
| 27 | } | ||||
| 28 | |||||
| 29 | 3 | 36µs | 9 | 17µs | if ($path !~ /\.par$/i && -e $path && ! -d _) { # spent 13µs making 3 calls to lib::CORE:ftis, avg 4µs/call
# spent 3µs making 3 calls to lib::CORE:match, avg 1µs/call
# spent 900ns making 3 calls to lib::CORE:ftdir, avg 300ns/call |
| 30 | require Carp; | ||||
| 31 | Carp::carp("Parameter to use lib must be directory, not file"); | ||||
| 32 | } | ||||
| 33 | 3 | 3µs | unshift(@INC, $path); | ||
| 34 | # Add any previous version directories we found at configure time | ||||
| 35 | 3 | 2µs | foreach my $incver (@inc_version_list) | ||
| 36 | { | ||||
| 37 | my $dir = "$path/$incver"; | ||||
| 38 | unshift(@INC, $dir) if -d $dir; | ||||
| 39 | } | ||||
| 40 | # Put a corresponding archlib directory in front of $path if it | ||||
| 41 | # looks like $path has an archlib directory below it. | ||||
| 42 | 3 | 5µs | 3 | 16µs | my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir) # spent 16µs making 3 calls to lib::_get_dirs, avg 5µs/call |
| 43 | = _get_dirs($path); | ||||
| 44 | 3 | 10µs | 3 | 6µs | unshift(@INC, $arch_dir) if -d $arch_auto_dir; # spent 6µs making 3 calls to lib::CORE:ftdir, avg 2µs/call |
| 45 | 3 | 7µs | 3 | 4µs | unshift(@INC, $version_dir) if -d $version_dir; # spent 4µs making 3 calls to lib::CORE:ftdir, avg 1µs/call |
| 46 | 3 | 8µs | 3 | 3µs | unshift(@INC, $version_arch_dir) if -d $version_arch_dir; # spent 3µs making 3 calls to lib::CORE:ftdir, avg 867ns/call |
| 47 | } | ||||
| 48 | |||||
| 49 | # remove trailing duplicates | ||||
| 50 | 2 | 13µs | @INC = grep { ++$names{$_} == 1 } @INC; | ||
| 51 | 2 | 7µs | return; | ||
| 52 | } | ||||
| 53 | |||||
| 54 | |||||
| 55 | sub unimport { | ||||
| 56 | shift; | ||||
| 57 | |||||
| 58 | my %names; | ||||
| 59 | foreach my $path (@_) { | ||||
| 60 | my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir) | ||||
| 61 | = _get_dirs($path); | ||||
| 62 | ++$names{$path}; | ||||
| 63 | ++$names{$arch_dir} if -d $arch_auto_dir; | ||||
| 64 | ++$names{$version_dir} if -d $version_dir; | ||||
| 65 | ++$names{$version_arch_dir} if -d $version_arch_dir; | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | # Remove ALL instances of each named directory. | ||||
| 69 | @INC = grep { !exists $names{$_} } @INC; | ||||
| 70 | return; | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | # spent 16µs within lib::_get_dirs which was called 3 times, avg 5µs/call:
# 3 times (16µs+0s) by lib::import at line 42, avg 5µs/call | ||||
| 74 | 3 | 1µs | my($dir) = @_; | ||
| 75 | 3 | 300ns | my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir); | ||
| 76 | |||||
| 77 | 3 | 2µs | $arch_auto_dir = "$dir/$archname/auto"; | ||
| 78 | 3 | 1µs | $arch_dir = "$dir/$archname"; | ||
| 79 | 3 | 800ns | $version_dir = "$dir/$version"; | ||
| 80 | 3 | 2µs | $version_arch_dir = "$dir/$version/$archname"; | ||
| 81 | |||||
| 82 | 3 | 7µs | return($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir); | ||
| 83 | } | ||||
| 84 | |||||
| 85 | 1 | 5µs | 1; | ||
| 86 | __END__ | ||||
# spent 13µs within lib::CORE:ftdir which was called 12 times, avg 1µs/call:
# 3 times (6µs+0s) by lib::import at line 44, avg 2µs/call
# 3 times (4µs+0s) by lib::import at line 45, avg 1µs/call
# 3 times (3µs+0s) by lib::import at line 46, avg 867ns/call
# 3 times (900ns+0s) by lib::import at line 29, avg 300ns/call | |||||
# spent 13µs within lib::CORE:ftis which was called 3 times, avg 4µs/call:
# 3 times (13µs+0s) by lib::import at line 29, avg 4µs/call | |||||
# spent 3µs within lib::CORE:match which was called 3 times, avg 1µs/call:
# 3 times (3µs+0s) by lib::import at line 29, avg 1µs/call |