← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Jun 30 16:34:56 2016
Reported on Thu Jun 30 16:35:08 2016

Filename/home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Log/Any/IfLOG.pm
StatementsExecuted 17 statements in 41µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11121µs34µsLog::Any::IfLOG::::import Log::Any::IfLOG::import
1116µs10µsLog::Any::IfLOG::::__log_singleton Log::Any::IfLOG::__log_singleton
1114µs4µsLog::Any::IfLOG::::__log_enabled Log::Any::IfLOG::__log_enabled
1114µs4µsLog::Any::IfLOG::DumbObj::::newLog::Any::IfLOG::DumbObj::new
0000s0sLog::Any::IfLOG::DumbObj::::AUTOLOADLog::Any::IfLOG::DumbObj::AUTOLOAD
0000s0sLog::Any::IfLOG::::get_logger Log::Any::IfLOG::get_logger
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Log::Any::IfLOG;
2
31600nsour $DATE = '2016-06-16'; # DATE
41200nsour $VERSION = '0.08'; # VERSION
5
6our $DEBUG;
7our $ENABLE_LOG;
8
91200nsmy $log_singleton;
10
# spent 10µs (6+4) within Log::Any::IfLOG::__log_singleton which was called: # once (6µs+4µs) by Log::Any::IfLOG::import at line 38
sub __log_singleton {
1111µs14µs if (!$log_singleton) { $log_singleton = Log::Any::IfLOG::DumbObj->new }
# spent 4µs making 1 call to Log::Any::IfLOG::DumbObj::new
1213µs $log_singleton;
13}
14
15
# spent 4µs within Log::Any::IfLOG::__log_enabled which was called: # once (4µs+0s) by Log::Any::IfLOG::import at line 32
sub __log_enabled {
1611µs if (defined $ENABLE_LOG) {
17 return $ENABLE_LOG;
18 } elsif ($INC{'Log/Any.pm'}) {
19 # Log::Any has been loaded, so we have absorbed the cost anyway
20 return 1;
21 } else {
22 return
23 $ENV{LOG} || $ENV{TRACE} || $ENV{DEBUG} ||
2419µs $ENV{VERBOSE} || $ENV{QUIET} || $ENV{LOG_LEVEL};
25 }
26}
27
28
# spent 34µs (21+14) within Log::Any::IfLOG::import which was called: # once (21µs+14µs) by DateTime::Format::Alami::BEGIN@9 at line 9 of lib/DateTime/Format/Alami.pm
sub import {
291600ns my $self = shift;
30
311600ns my $caller = caller();
3215µs14µs if (__log_enabled()) {
# spent 4µs making 1 call to Log::Any::IfLOG::__log_enabled
33 require Log::Any;
34 Log::Any->_export_to_caller($caller, @_);
35 } else {
3612µs my $saw_log_param = grep { $_ eq '$log' } @_;
371600ns if ($saw_log_param) {
3811µs110µs __log_singleton(); # to init $log_singleton
# spent 10µs making 1 call to Log::Any::IfLOG::__log_singleton
3914µs *{"$caller\::log"} = \$log_singleton;
40 }
41 }
42}
43
44sub get_logger {
45 if (__log_enabled()) {
46 require Log::Any;
47 my $class = shift;
48 if ($class eq 'Log::Any::IfLOG') {
49 Log::Any->get_logger(@_);
50 } else {
51 Log::Any::get_logger($class, @_);
52 }
53 } else {
54 return __log_singleton();
55 }
56}
57
58package
59 Log::Any::IfLOG::DumbObj;
6027µs
# spent 4µs within Log::Any::IfLOG::DumbObj::new which was called: # once (4µs+0s) by Log::Any::IfLOG::__log_singleton at line 11
sub new { my $o = ""; bless \$o, shift }
61sub AUTOLOAD { 0 }
62
6314µs1;
64# ABSTRACT: Load Log::Any only if "logging is enabled"
65
66__END__