← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Jun 30 16:16:00 2016
Reported on Thu Jun 30 16:16: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 54µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11126µs44µsLog::Any::IfLOG::::import Log::Any::IfLOG::import
1118µs12µsLog::Any::IfLOG::::__log_singleton Log::Any::IfLOG::__log_singleton
1115µs5µsLog::Any::IfLOG::::__log_enabled Log::Any::IfLOG::__log_enabled
1115µs5µ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
31700nsour $DATE = '2016-06-16'; # DATE
41200nsour $VERSION = '0.08'; # VERSION
5
6our $DEBUG;
7our $ENABLE_LOG;
8
91300nsmy $log_singleton;
10
# spent 12µs (8+5) within Log::Any::IfLOG::__log_singleton which was called: # once (8µs+5µs) by Log::Any::IfLOG::import at line 38
sub __log_singleton {
1112µs15µs if (!$log_singleton) { $log_singleton = Log::Any::IfLOG::DumbObj->new }
# spent 5µs making 1 call to Log::Any::IfLOG::DumbObj::new
1214µs $log_singleton;
13}
14
15
# spent 5µs within Log::Any::IfLOG::__log_enabled which was called: # once (5µ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} ||
24111µs $ENV{VERBOSE} || $ENV{QUIET} || $ENV{LOG_LEVEL};
25 }
26}
27
28
# spent 44µs (26+18) within Log::Any::IfLOG::import which was called: # once (26µs+18µs) by DateTime::Format::Alami::BEGIN@9 at line 9 of DateTime/Format/Alami.pm
sub import {
291800ns my $self = shift;
30
311900ns my $caller = caller();
3218µs15µs if (__log_enabled()) {
# spent 5µ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µs112µs __log_singleton(); # to init $log_singleton
# spent 12µs making 1 call to Log::Any::IfLOG::__log_singleton
3915µ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;
6029µs
# spent 5µs within Log::Any::IfLOG::DumbObj::new which was called: # once (5µs+0s) by Log::Any::IfLOG::__log_singleton at line 11
sub new { my $o = ""; bless \$o, shift }
61sub AUTOLOAD { 0 }
62
6316µs1;
64# ABSTRACT: Load Log::Any only if "logging is enabled"
65
66__END__