| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Log/Log4perl/Util.pm |
| Statements | Executed 16 statements in 257µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.52ms | 1.64ms | Log::Log4perl::Util::BEGIN@3 |
| 2 | 2 | 2 | 554µs | 985µs | Log::Log4perl::Util::module_available |
| 2 | 1 | 1 | 3µs | 3µs | Log::Log4perl::Util::CORE:match (opcode) |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::Util::__ANON__[:16] |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::Util::tmpfile_name |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Log::Log4perl::Util; | ||||
| 2 | |||||
| 3 | 3 | 187µs | 1 | 1.64ms | # spent 1.64ms (1.52+120µs) within Log::Log4perl::Util::BEGIN@3 which was called:
# once (1.52ms+120µs) by Log::Log4perl::BEGIN@11 at line 3 # spent 1.64ms making 1 call to Log::Log4perl::Util::BEGIN@3 |
| 4 | |||||
| 5 | ################################################## | ||||
| 6 | # spent 985µs (554+431) within Log::Log4perl::Util::module_available which was called 2 times, avg 492µs/call:
# once (526µs+430µs) by Log::Log4perl::Util::TimeTracker::BEGIN@13 at line 18 of Log/Log4perl/Util/TimeTracker.pm
# once (27µs+2µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@29 at line 32 of Log/Log4perl/Layout/PatternLayout.pm | ||||
| 7 | ################################################## | ||||
| 8 | 2 | 2µs | my($full_name) = @_; | ||
| 9 | |||||
| 10 | # Weird cases like "strict;" (including the semicolon) would | ||||
| 11 | # succeed with the eval below, so check those up front. | ||||
| 12 | # I can't believe Perl doesn't have a proper way to check if a | ||||
| 13 | # module is available or not! | ||||
| 14 | 2 | 11µs | 2 | 3µs | return 0 if $full_name =~ /[^\w:]/; # spent 3µs making 2 calls to Log::Log4perl::Util::CORE:match, avg 2µs/call |
| 15 | |||||
| 16 | 2 | 8µs | local $SIG{__DIE__} = sub {}; | ||
| 17 | |||||
| 18 | 2 | 34µs | eval "require $full_name"; # spent 61µs executing statements in string eval
# spent 2µs executing statements in string eval | ||
| 19 | |||||
| 20 | 2 | 900ns | if($@) { | ||
| 21 | return 0; | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | 2 | 14µs | return 1; | ||
| 25 | } | ||||
| 26 | |||||
| 27 | ################################################## | ||||
| 28 | sub tmpfile_name { # File::Temp without the bells and whistles | ||||
| 29 | ################################################## | ||||
| 30 | |||||
| 31 | my $name = File::Spec->catfile(File::Spec->tmpdir(), | ||||
| 32 | 'l4p-tmpfile-' . | ||||
| 33 | "$$-" . | ||||
| 34 | int(rand(9999999))); | ||||
| 35 | |||||
| 36 | # Some crazy versions of File::Spec use backslashes on Win32 | ||||
| 37 | $name =~ s#\\#/#g; | ||||
| 38 | return $name; | ||||
| 39 | } | ||||
| 40 | |||||
| 41 | 1 | 2µs | 1; | ||
| 42 | |||||
| 43 | __END__ | ||||
# spent 3µs within Log::Log4perl::Util::CORE:match which was called 2 times, avg 2µs/call:
# 2 times (3µs+0s) by Log::Log4perl::Util::module_available at line 14, avg 2µs/call |