Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Log/Any/Proxy.pm |
Statements | Executed 35176 statements in 101ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4004 | 1 | 1 | 43.0ms | 47.4ms | __ANON__[:83] | Log::Any::Proxy::
2003 | 1 | 1 | 22.6ms | 24.5ms | new | Log::Any::Proxy::
1001 | 1 | 1 | 21.3ms | 22.2ms | __ANON__[:75] | Log::Any::Proxy::
2002 | 1 | 1 | 13.8ms | 16.7ms | __ANON__[:64] | Log::Any::Proxy::
2003 | 1 | 1 | 1.90ms | 1.90ms | init | Log::Any::Proxy::
1 | 1 | 1 | 9µs | 9µs | BEGIN@1 | Log::Any::Adapter::Util::
1 | 1 | 1 | 6µs | 11µs | BEGIN@60 | Log::Any::Proxy::
1 | 1 | 1 | 5µs | 11µs | BEGIN@46 | Log::Any::Proxy::
1 | 1 | 1 | 4µs | 5µs | BEGIN@2 | Log::Any::Adapter::Util::
1 | 1 | 1 | 4µs | 6µs | BEGIN@3 | Log::Any::Adapter::Util::
1 | 1 | 1 | 4µs | 4µs | BEGIN@10 | Log::Any::Proxy::
0 | 0 | 0 | 0s | 0s | __ANON__[:47] | Log::Any::Proxy::
0 | 0 | 0 | 0s | 0s | _default_formatter | Log::Any::Proxy::
0 | 0 | 0 | 0s | 0s | _dump_one_line | Log::Any::Proxy::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 25µs | 1 | 9µs | # spent 9µs within Log::Any::Adapter::Util::BEGIN@1 which was called:
# once (9µs+0s) by Log::Any::Adapter::Util::require_dynamic at line 1 # spent 9µs making 1 call to Log::Any::Adapter::Util::BEGIN@1 |
2 | 2 | 11µs | 2 | 6µs | # spent 5µs (4+1) within Log::Any::Adapter::Util::BEGIN@2 which was called:
# once (4µs+1µs) by Log::Any::Adapter::Util::require_dynamic at line 2 # spent 5µs making 1 call to Log::Any::Adapter::Util::BEGIN@2
# spent 1µs making 1 call to strict::import |
3 | 2 | 25µs | 2 | 9µs | # spent 6µs (4+3) within Log::Any::Adapter::Util::BEGIN@3 which was called:
# once (4µs+3µs) by Log::Any::Adapter::Util::require_dynamic at line 3 # spent 6µs making 1 call to Log::Any::Adapter::Util::BEGIN@3
# spent 3µs making 1 call to warnings::import |
4 | |||||
5 | package Log::Any::Proxy; | ||||
6 | |||||
7 | # ABSTRACT: Log::Any generator proxy object | ||||
8 | 1 | 200ns | our $VERSION = '1.032'; | ||
9 | |||||
10 | 2 | 138µs | 1 | 4µs | # spent 4µs within Log::Any::Proxy::BEGIN@10 which was called:
# once (4µs+0s) by Log::Any::Adapter::Util::require_dynamic at line 10 # spent 4µs making 1 call to Log::Any::Proxy::BEGIN@10 |
11 | |||||
12 | sub _default_formatter { | ||||
13 | my ( $cat, $lvl, $format, @params ) = @_; | ||||
14 | my @new_params = | ||||
15 | map { !defined($_) ? '<undef>' : ref($_) ? _dump_one_line($_) : $_ } | ||||
16 | @params; | ||||
17 | return sprintf( $format, @new_params ); | ||||
18 | } | ||||
19 | |||||
20 | sub _dump_one_line { | ||||
21 | my ($value) = @_; | ||||
22 | |||||
23 | return Data::Dumper->new( [$value] )->Indent(0)->Sortkeys(1)->Quotekeys(0) | ||||
24 | ->Terse(1)->Useqq(1)->Dump(); | ||||
25 | } | ||||
26 | |||||
27 | # spent 24.5ms (22.6+1.90) within Log::Any::Proxy::new which was called 2003 times, avg 12µs/call:
# 2003 times (22.6ms+1.90ms) by Log::Any::get_logger at line 85 of Log/Any.pm, avg 12µs/call | ||||
28 | 2003 | 740µs | my $class = shift; | ||
29 | 2003 | 5.42ms | my $self = { formatter => \&_default_formatter, @_ }; | ||
30 | 2003 | 1.22ms | unless ( $self->{adapter} ) { | ||
31 | require Carp; | ||||
32 | Carp::croak("$class requires an 'adapter' parameter"); | ||||
33 | } | ||||
34 | 2003 | 886µs | unless ( $self->{category} ) { | ||
35 | require Carp; | ||||
36 | Carp::croak("$class requires an 'category' parameter") | ||||
37 | } | ||||
38 | 2003 | 914µs | bless $self, $class; | ||
39 | 2003 | 3.81ms | 2003 | 1.90ms | $self->init(@_); # spent 1.90ms making 2003 calls to Log::Any::Proxy::init, avg 947ns/call |
40 | 2003 | 3.38ms | return $self; | ||
41 | } | ||||
42 | |||||
43 | 2003 | 9.13ms | # spent 1.90ms within Log::Any::Proxy::init which was called 2003 times, avg 947ns/call:
# 2003 times (1.90ms+0s) by Log::Any::Proxy::new at line 39, avg 947ns/call | ||
44 | |||||
45 | 1 | 500ns | for my $attr (qw/adapter filter formatter prefix/) { | ||
46 | 2 | 67µs | 2 | 17µs | # spent 11µs (5+6) within Log::Any::Proxy::BEGIN@46 which was called:
# once (5µs+6µs) by Log::Any::Adapter::Util::require_dynamic at line 46 # spent 11µs making 1 call to Log::Any::Proxy::BEGIN@46
# spent 6µs making 1 call to strict::unimport |
47 | 4 | 6µs | *{$attr} = sub { return $_[0]->{$attr} }; | ||
48 | } | ||||
49 | |||||
50 | 1 | 2µs | 1 | 2µs | my %aliases = Log::Any::Adapter::Util::log_level_aliases(); # spent 2µs making 1 call to Log::Any::Adapter::Util::log_level_aliases |
51 | |||||
52 | # Set up methods/aliases and detection methods/aliases | ||||
53 | 1 | 1µs | 1 | 800ns | foreach my $name ( Log::Any::Adapter::Util::logging_methods(), keys(%aliases) ) # spent 800ns making 1 call to Log::Any::Adapter::Util::logging_methods |
54 | { | ||||
55 | 14 | 3µs | my $realname = $aliases{$name} || $name; | ||
56 | 14 | 3µs | my $namef = $name . "f"; | ||
57 | 14 | 2µs | my $is_name = "is_$name"; | ||
58 | 14 | 3µs | my $is_realname = "is_$realname"; | ||
59 | 14 | 9µs | 14 | 14µs | my $numeric = Log::Any::Adapter::Util::numeric_level($realname); # spent 14µs making 14 calls to Log::Any::Adapter::Util::numeric_level, avg 1µs/call |
60 | 2 | 143µs | 2 | 17µs | # spent 11µs (6+6) within Log::Any::Proxy::BEGIN@60 which was called:
# once (6µs+6µs) by Log::Any::Adapter::Util::require_dynamic at line 60 # spent 11µs making 1 call to Log::Any::Proxy::BEGIN@60
# spent 6µs making 1 call to strict::unimport |
61 | # spent 16.7ms (13.8+2.89) within Log::Any::Proxy::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Log/Any/Proxy.pm:64] which was called 2002 times, avg 8µs/call:
# 2002 times (13.8ms+2.89ms) by Search::Elasticsearch::Role::Logger::is_trace at line 17 of (eval 305)[Sub/Quote.pm:3], avg 8µs/call | ||||
62 | 2002 | 866µs | my ($self) = @_; | ||
63 | 2002 | 29.7ms | 2002 | 2.89ms | return $self->{adapter}->$is_realname; # spent 2.89ms making 2002 calls to Log::Any::Adapter::Null::__ANON__[Log/Any/Adapter/Null.pm:18], avg 1µs/call |
64 | 14 | 19µs | }; | ||
65 | # spent 22.2ms (21.3+891µs) within Log::Any::Proxy::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Log/Any/Proxy.pm:75] which was called 1001 times, avg 22µs/call:
# 1001 times (21.3ms+891µs) by Search::Elasticsearch::Role::Logger::info at line 17 of (eval 287)[Sub/Quote.pm:3], avg 22µs/call | ||||
66 | 1001 | 734µs | my ( $self, @parts ) = @_; | ||
67 | 1001 | 2.46ms | my $message = join(" ", grep { defined($_) && length($_) } @parts ); | ||
68 | 1001 | 309µs | return unless length $message; | ||
69 | $message = $self->{filter}->( $self->{category}, $numeric, $message ) | ||||
70 | 1001 | 726µs | if defined $self->{filter}; | ||
71 | 1001 | 530µs | return unless defined $message and length $message; | ||
72 | $message = "$self->{prefix}$message" | ||||
73 | 1001 | 548µs | if defined $self->{prefix} && length $self->{prefix}; | ||
74 | 1001 | 3.87ms | 1001 | 891µs | return $self->{adapter}->$realname($message); # spent 891µs making 1001 calls to Log::Any::Adapter::Null::__ANON__[Log/Any/Adapter/Null.pm:18], avg 890ns/call |
75 | 14 | 17µs | }; | ||
76 | # spent 47.4ms (43.0+4.36) within Log::Any::Proxy::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Log/Any/Proxy.pm:83] which was called 4004 times, avg 12µs/call:
# 4004 times (43.0ms+4.36ms) by Search::Elasticsearch::Role::Logger::infof at line 17 of (eval 285)[Sub/Quote.pm:3], avg 12µs/call | ||||
77 | 4004 | 3.09ms | my ( $self, @args ) = @_; | ||
78 | 4004 | 32.6ms | 4004 | 4.36ms | return unless $self->{adapter}->$is_realname; # spent 4.36ms making 4004 calls to Log::Any::Adapter::Null::__ANON__[Log/Any/Adapter/Null.pm:18], avg 1µs/call |
79 | my $message = | ||||
80 | $self->{formatter}->( $self->{category}, $numeric, @args ); | ||||
81 | return unless defined $message and length $message; | ||||
82 | return $self->$name($message); | ||||
83 | 14 | 23µs | }; | ||
84 | } | ||||
85 | |||||
86 | 1 | 6µs | 1; | ||
87 | |||||
88 | |||||
89 | # vim: ts=4 sts=4 sw=4 et tw=75: | ||||
90 | |||||
91 | __END__ |