Profile of Log/Log4perl/Util.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:53 2012

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

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 1.52ms | 1.64ms | Log::Log4perl::Util::::BEGIN@3Log::Log4perl::Util::BEGIN@3
2 | 2 | 2 | 554µs | 985µs | Log::Log4perl::Util::::module_availableLog::Log4perl::Util::module_available
2 | 1 | 1 | 3µs | 3µs | Log::Log4perl::Util::::CORE:matchLog::Log4perl::Util::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | Log::Log4perl::Util::::__ANON__[:16]Log::Log4perl::Util::__ANON__[:16]
0 | 0 | 0 | 0s | 0s | Log::Log4perl::Util::::tmpfile_nameLog::Log4perl::Util::tmpfile_name

Call graph for these subroutines as a Graphviz dot language file.

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 use File::Spec; # 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 sub module_available { # Check if a module is available
7 |  |  |  |  | ##################################################
8 | 12 | 69µ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 | 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 |  |  |  |  | local $SIG{__DIE__} = sub {};
17 |  |  |  |  |
18 |  |  |  |  | eval "require $full_name"; # spent 61µs executing statements in string eval # spent 2µs executing statements in string eval
19 |  |  |  |  |
20 |  |  |  |  | if($@) {
21 |  |  |  |  | return 0;
22 |  |  |  |  | }
23 |  |  |  |  |
24 |  |  |  |  | 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 sub Log::Log4perl::Util::CORE:match; # opcode