← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Log/Any/Proxy.pm
StatementsExecuted 35176 statements in 101ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
40041143.0ms47.4msLog::Any::Proxy::::__ANON__[:83] Log::Any::Proxy::__ANON__[:83]
20031122.6ms24.5msLog::Any::Proxy::::new Log::Any::Proxy::new
10011121.3ms22.2msLog::Any::Proxy::::__ANON__[:75] Log::Any::Proxy::__ANON__[:75]
20021113.8ms16.7msLog::Any::Proxy::::__ANON__[:64] Log::Any::Proxy::__ANON__[:64]
2003111.90ms1.90msLog::Any::Proxy::::init Log::Any::Proxy::init
1119µs9µsLog::Any::Adapter::Util::::BEGIN@1Log::Any::Adapter::Util::BEGIN@1
1116µs11µsLog::Any::Proxy::::BEGIN@60 Log::Any::Proxy::BEGIN@60
1115µs11µsLog::Any::Proxy::::BEGIN@46 Log::Any::Proxy::BEGIN@46
1114µs5µsLog::Any::Adapter::Util::::BEGIN@2Log::Any::Adapter::Util::BEGIN@2
1114µs6µsLog::Any::Adapter::Util::::BEGIN@3Log::Any::Adapter::Util::BEGIN@3
1114µs4µsLog::Any::Proxy::::BEGIN@10 Log::Any::Proxy::BEGIN@10
0000s0sLog::Any::Proxy::::__ANON__[:47] Log::Any::Proxy::__ANON__[:47]
0000s0sLog::Any::Proxy::::_default_formatter Log::Any::Proxy::_default_formatter
0000s0sLog::Any::Proxy::::_dump_one_line Log::Any::Proxy::_dump_one_line
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1225µs19µ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
use 5.008001;
# spent 9µs making 1 call to Log::Any::Adapter::Util::BEGIN@1
2211µs26µ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
use strict;
# spent 5µs making 1 call to Log::Any::Adapter::Util::BEGIN@2 # spent 1µs making 1 call to strict::import
3225µs29µ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
use warnings;
# spent 6µs making 1 call to Log::Any::Adapter::Util::BEGIN@3 # spent 3µs making 1 call to warnings::import
4
5package Log::Any::Proxy;
6
7# ABSTRACT: Log::Any generator proxy object
81200nsour $VERSION = '1.032';
9
102138µs14µ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
use Log::Any::Adapter::Util ();
# spent 4µs making 1 call to Log::Any::Proxy::BEGIN@10
11
12sub _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
20sub _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
sub new {
282003740µs my $class = shift;
2920035.42ms my $self = { formatter => \&_default_formatter, @_ };
3020031.22ms unless ( $self->{adapter} ) {
31 require Carp;
32 Carp::croak("$class requires an 'adapter' parameter");
33 }
342003886µs unless ( $self->{category} ) {
35 require Carp;
36 Carp::croak("$class requires an 'category' parameter")
37 }
382003914µs bless $self, $class;
3920033.81ms20031.90ms $self->init(@_);
# spent 1.90ms making 2003 calls to Log::Any::Proxy::init, avg 947ns/call
4020033.38ms return $self;
41}
42
4320039.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
sub init { }
44
451500nsfor my $attr (qw/adapter filter formatter prefix/) {
46267µs217µ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
no strict 'refs';
# spent 11µs making 1 call to Log::Any::Proxy::BEGIN@46 # spent 6µs making 1 call to strict::unimport
4746µs *{$attr} = sub { return $_[0]->{$attr} };
48}
49
5012µs12µsmy %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
5311µs1800nsforeach my $name ( Log::Any::Adapter::Util::logging_methods(), keys(%aliases) )
# spent 800ns making 1 call to Log::Any::Adapter::Util::logging_methods
54{
55143µs my $realname = $aliases{$name} || $name;
56143µs my $namef = $name . "f";
57142µs my $is_name = "is_$name";
58143µs my $is_realname = "is_$realname";
59149µs1414µ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
602143µs217µ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
no strict 'refs';
# 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
*{$is_name} = sub {
622002866µs my ($self) = @_;
63200229.7ms20022.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
641419µ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
*{$name} = sub {
661001734µs my ( $self, @parts ) = @_;
6710012.46ms my $message = join(" ", grep { defined($_) && length($_) } @parts );
681001309µs return unless length $message;
69 $message = $self->{filter}->( $self->{category}, $numeric, $message )
701001726µs if defined $self->{filter};
711001530µs return unless defined $message and length $message;
72 $message = "$self->{prefix}$message"
731001548µs if defined $self->{prefix} && length $self->{prefix};
7410013.87ms1001891µ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
751417µ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
*{$namef} = sub {
7740043.09ms my ( $self, @args ) = @_;
78400432.6ms40044.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);
831423µs };
84}
85
8616µs1;
87
88
89# vim: ts=4 sts=4 sw=4 et tw=75:
90
91__END__