Filename | /opt/flows/lib/lib/perl5/Log/Any/Proxy.pm |
Statements | Executed 168 statements in 1.09ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 1 | 1 | 33µs | 38µs | __ANON__[:80] | Log::Any::Proxy::
2 | 1 | 1 | 26µs | 29µs | new | Log::Any::Proxy::
1 | 1 | 1 | 19µs | 19µs | BEGIN@1 | Log::Any::Adapter::Util::
2 | 1 | 1 | 18µs | 21µs | __ANON__[:61] | Log::Any::Proxy::
1 | 1 | 1 | 12µs | 17µs | BEGIN@3 | Log::Any::Adapter::Util::
1 | 1 | 1 | 10µs | 11µs | __ANON__[:72] | Log::Any::Proxy::
1 | 1 | 1 | 9µs | 21µs | BEGIN@43 | Log::Any::Proxy::
1 | 1 | 1 | 8µs | 20µs | BEGIN@57 | Log::Any::Proxy::
1 | 1 | 1 | 8µs | 21µs | BEGIN@2 | Log::Any::Adapter::Util::
1 | 1 | 1 | 5µs | 5µs | BEGIN@10 | Log::Any::Proxy::
2 | 1 | 1 | 2µs | 2µs | init | Log::Any::Proxy::
0 | 0 | 0 | 0s | 0s | __ANON__[:44] | Log::Any::Proxy::
0 | 0 | 0 | 0s | 0s | _default_formatter | Log::Any::Proxy::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 52µs | 1 | 19µs | # spent 19µs within Log::Any::Adapter::Util::BEGIN@1 which was called:
# once (19µs+0s) by Log::Any::Adapter::Util::require_dynamic at line 1 # spent 19µs making 1 call to Log::Any::Adapter::Util::BEGIN@1 |
2 | 2 | 27µs | 2 | 35µs | # spent 21µs (8+14) within Log::Any::Adapter::Util::BEGIN@2 which was called:
# once (8µs+14µs) by Log::Any::Adapter::Util::require_dynamic at line 2 # spent 21µs making 1 call to Log::Any::Adapter::Util::BEGIN@2
# spent 14µs making 1 call to strict::import |
3 | 2 | 51µs | 2 | 22µs | # spent 17µs (12+5) within Log::Any::Adapter::Util::BEGIN@3 which was called:
# once (12µs+5µs) by Log::Any::Adapter::Util::require_dynamic at line 3 # spent 17µs making 1 call to Log::Any::Adapter::Util::BEGIN@3
# spent 5µs making 1 call to warnings::import |
4 | |||||
5 | package Log::Any::Proxy; | ||||
6 | |||||
7 | # ABSTRACT: Log::Any generator proxy object | ||||
8 | 1 | 700ns | our $VERSION = '1.040'; | ||
9 | |||||
10 | 2 | 234µs | 1 | 5µs | # spent 5µs within Log::Any::Proxy::BEGIN@10 which was called:
# once (5µs+0s) by Log::Any::Adapter::Util::require_dynamic at line 10 # spent 5µs making 1 call to Log::Any::Proxy::BEGIN@10 |
11 | |||||
12 | sub _default_formatter { | ||||
13 | my ( $cat, $lvl, $format, @params ) = @_; | ||||
14 | return $format->() if ref($format) eq 'CODE'; | ||||
15 | my @new_params = | ||||
16 | map { | ||||
17 | !defined($_) ? '<undef>' | ||||
18 | : ref($_) ? Log::Any::Adapter::Util::dump_one_line($_) | ||||
19 | : $_ | ||||
20 | } @params; | ||||
21 | return sprintf( $format, @new_params ); | ||||
22 | } | ||||
23 | |||||
24 | # spent 29µs (26+2) within Log::Any::Proxy::new which was called 2 times, avg 14µs/call:
# 2 times (26µs+2µs) by Log::Any::get_logger at line 85 of /opt/flows/lib/lib/perl5/Log/Any.pm, avg 14µs/call | ||||
25 | 2 | 1µs | my $class = shift; | ||
26 | 2 | 6µs | my $self = { formatter => \&_default_formatter, @_ }; | ||
27 | 2 | 6µs | unless ( $self->{adapter} ) { | ||
28 | require Carp; | ||||
29 | Carp::croak("$class requires an 'adapter' parameter"); | ||||
30 | } | ||||
31 | 2 | 800ns | unless ( $self->{category} ) { | ||
32 | require Carp; | ||||
33 | Carp::croak("$class requires an 'category' parameter") | ||||
34 | } | ||||
35 | 2 | 2µs | bless $self, $class; | ||
36 | 2 | 3µs | 2 | 2µs | $self->init(@_); # spent 2µs making 2 calls to Log::Any::Proxy::init, avg 1µs/call |
37 | 2 | 17µs | return $self; | ||
38 | } | ||||
39 | |||||
40 | 2 | 7µs | # spent 2µs within Log::Any::Proxy::init which was called 2 times, avg 1µs/call:
# 2 times (2µs+0s) by Log::Any::Proxy::new at line 36, avg 1µs/call | ||
41 | |||||
42 | 1 | 1µs | for my $attr (qw/adapter filter formatter prefix/) { | ||
43 | 2 | 147µs | 2 | 34µs | # spent 21µs (9+12) within Log::Any::Proxy::BEGIN@43 which was called:
# once (9µs+12µs) by Log::Any::Adapter::Util::require_dynamic at line 43 # spent 21µs making 1 call to Log::Any::Proxy::BEGIN@43
# spent 12µs making 1 call to strict::unimport |
44 | 4 | 13µs | *{$attr} = sub { return $_[0]->{$attr} }; | ||
45 | } | ||||
46 | |||||
47 | 1 | 4µs | 1 | 4µs | my %aliases = Log::Any::Adapter::Util::log_level_aliases(); # spent 4µs making 1 call to Log::Any::Adapter::Util::log_level_aliases |
48 | |||||
49 | # Set up methods/aliases and detection methods/aliases | ||||
50 | 1 | 2µs | 1 | 2µs | foreach my $name ( Log::Any::Adapter::Util::logging_methods(), keys(%aliases) ) # spent 2µs making 1 call to Log::Any::Adapter::Util::logging_methods |
51 | { | ||||
52 | 14 | 7µs | my $realname = $aliases{$name} || $name; | ||
53 | 14 | 4µs | my $namef = $name . "f"; | ||
54 | 14 | 3µs | my $is_name = "is_$name"; | ||
55 | 14 | 3µs | my $is_realname = "is_$realname"; | ||
56 | 14 | 15µs | 14 | 25µs | my $numeric = Log::Any::Adapter::Util::numeric_level($realname); # spent 25µs making 14 calls to Log::Any::Adapter::Util::numeric_level, avg 2µs/call |
57 | 2 | 284µs | 2 | 32µs | # spent 20µs (8+12) within Log::Any::Proxy::BEGIN@57 which was called:
# once (8µs+12µs) by Log::Any::Adapter::Util::require_dynamic at line 57 # spent 20µs making 1 call to Log::Any::Proxy::BEGIN@57
# spent 12µs making 1 call to strict::unimport |
58 | # spent 21µs (18+3) within Log::Any::Proxy::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Proxy.pm:61] which was called 2 times, avg 10µs/call:
# 2 times (18µs+3µs) by Search::Elasticsearch::Role::Logger::is_trace at line 12 of (eval 108)[Sub/Quote.pm:5], avg 10µs/call | ||||
59 | 2 | 1µs | my ($self) = @_; | ||
60 | 2 | 14µs | 2 | 3µs | return $self->{adapter}->$is_realname; # spent 3µs making 2 calls to Log::Any::Adapter::Null::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Adapter/Null.pm:19], avg 2µs/call |
61 | 14 | 44µs | }; | ||
62 | # spent 11µs (10+800ns) within Log::Any::Proxy::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Proxy.pm:72] which was called:
# once (10µs+800ns) by Search::Elasticsearch::Role::Logger::info at line 12 of (eval 93)[Sub/Quote.pm:5] | ||||
63 | 1 | 1µs | my ( $self, @parts ) = @_; | ||
64 | 1 | 2µs | my $message = join(" ", grep { defined($_) && length($_) } @parts ); | ||
65 | 1 | 200ns | return unless length $message; | ||
66 | 1 | 400ns | $message = $self->{filter}->( $self->{category}, $numeric, $message ) | ||
67 | if defined $self->{filter}; | ||||
68 | 1 | 300ns | return unless defined $message and length $message; | ||
69 | 1 | 300ns | $message = "$self->{prefix}$message" | ||
70 | if defined $self->{prefix} && length $self->{prefix}; | ||||
71 | 1 | 5µs | 1 | 800ns | return $self->{adapter}->$realname($message); # spent 800ns making 1 call to Log::Any::Adapter::Null::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Adapter/Null.pm:19] |
72 | 14 | 47µs | }; | ||
73 | # spent 38µs (33+5) within Log::Any::Proxy::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Proxy.pm:80] which was called 4 times, avg 10µs/call:
# 4 times (33µs+5µs) by Search::Elasticsearch::Role::Logger::infof at line 12 of (eval 89)[Sub/Quote.pm:5], avg 10µs/call | ||||
74 | 4 | 5µs | my ( $self, @args ) = @_; | ||
75 | 4 | 26µs | 4 | 5µs | return unless $self->{adapter}->$is_realname; # spent 5µs making 4 calls to Log::Any::Adapter::Null::__ANON__[/opt/flows/lib/lib/perl5/Log/Any/Adapter/Null.pm:19], avg 1µs/call |
76 | my $message = | ||||
77 | $self->{formatter}->( $self->{category}, $numeric, @args ); | ||||
78 | return unless defined $message and length $message; | ||||
79 | return $self->$name($message); | ||||
80 | 14 | 44µs | }; | ||
81 | } | ||||
82 | |||||
83 | 1 | 10µs | 1; | ||
84 | |||||
85 | |||||
86 | # vim: ts=4 sts=4 sw=4 et tw=75: | ||||
87 | |||||
88 | __END__ |