← 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.pm
StatementsExecuted 22077 statements in 69.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
20033264.9ms124msLog::Any::::get_logger Log::Any::get_logger
2003115.56ms5.56msLog::Any::::_get_proxy_class Log::Any::_get_proxy_class
2003112.64ms2.64msLog::Any::::_manager Log::Any::_manager
111661µs701µsLog::Any::::BEGIN@10 Log::Any::BEGIN@10
111635µs887µsLog::Any::::BEGIN@11 Log::Any::BEGIN@11
21112µs1.23msLog::Any::::_export_to_caller Log::Any::_export_to_caller
11110µs10µsCHI::Stats::::BEGIN@1CHI::Stats::BEGIN@1
2229µs1.24msLog::Any::::import Log::Any::import
1116µs7µsCHI::Stats::::BEGIN@2CHI::Stats::BEGIN@2
1115µs12µsLog::Any::::BEGIN@72 Log::Any::BEGIN@72
1115µs12µsLog::Any::::BEGIN@63 Log::Any::BEGIN@63
1115µs8µsCHI::Stats::::BEGIN@3.30CHI::Stats::BEGIN@3.30
0000s0sLog::Any::::set_adapter Log::Any::set_adapter
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1225µs110µs
# spent 10µs within CHI::Stats::BEGIN@1 which was called: # once (10µs+0s) by CHI::Stats::BEGIN@5 at line 1
use 5.008001;
# spent 10µs making 1 call to CHI::Stats::BEGIN@1
2212µs28µs
# spent 7µs (6+1) within CHI::Stats::BEGIN@2 which was called: # once (6µs+1µs) by CHI::Stats::BEGIN@5 at line 2
use strict;
# spent 7µs making 1 call to CHI::Stats::BEGIN@2 # spent 1µs making 1 call to strict::import
3228µs211µs
# spent 8µs (5+3) within CHI::Stats::BEGIN@3.30 which was called: # once (5µs+3µs) by CHI::Stats::BEGIN@5 at line 3
use warnings;
# spent 8µs making 1 call to CHI::Stats::BEGIN@3.30 # spent 3µs making 1 call to warnings::import
4
5package Log::Any;
6
7# ABSTRACT: Bringing loggers and listeners together
81300nsour $VERSION = '1.032';
9
10263µs1701µs
# spent 701µs (661+39) within Log::Any::BEGIN@10 which was called: # once (661µs+39µs) by CHI::Stats::BEGIN@5 at line 10
use Log::Any::Manager;
# spent 701µs making 1 call to Log::Any::BEGIN@10
1114µs150µs
# spent 887µs (635+252) within Log::Any::BEGIN@11 which was called: # once (635µs+252µs) by CHI::Stats::BEGIN@5 at line 19
use Log::Any::Adapter::Util qw(
# spent 50µs making 1 call to Exporter::import
12 require_dynamic
13 detection_aliases
14 detection_methods
15 log_level_aliases
16 logging_aliases
17 logging_and_detection_methods
18 logging_methods
191188µs1887µs);
# spent 887µs making 1 call to Log::Any::BEGIN@11
20
21# This is overridden in Log::Any::Test
22our $OverrideDefaultAdapterClass;
23our $OverrideDefaultProxyClass;
24
25# singleton and accessor
26{
2712µs13µs my $manager = Log::Any::Manager->new();
# spent 3µs making 1 call to Log::Any::Manager::new
28200316.7ms
# spent 2.64ms within Log::Any::_manager which was called 2003 times, avg 1µs/call: # 2003 times (2.64ms+0s) by Log::Any::get_logger at line 82, avg 1µs/call
sub _manager { return $manager }
29}
30
311200ns
# spent 1.24ms (9µs+1.23) within Log::Any::import which was called 2 times, avg 621µs/call: # once (4µs+1.23ms) by CHI::Stats::BEGIN@5 at line 5 of CHI/Stats.pm # once (5µs+4µs) by Log::Any::Adapter::BEGIN@10 at line 10 of Log/Any/Adapter.pm
sub import {
322500ns my $class = shift;
3321µs my $caller = caller();
34
3522µs my @export_params = ( $caller, @_ );
3628µs21.23ms $class->_export_to_caller(@export_params);
# spent 1.23ms making 2 calls to Log::Any::_export_to_caller, avg 616µs/call
37}
38
39
# spent 1.23ms (12µs+1.22) within Log::Any::_export_to_caller which was called 2 times, avg 616µs/call: # 2 times (12µs+1.22ms) by Log::Any::import at line 36, avg 616µs/call
sub _export_to_caller {
402300ns my $class = shift;
412500ns my $caller = shift;
42
43 # Parse parameters passed to 'use Log::Any'
442800ns my $saw_log_param;
45 my @params;
4622µs while ( my $param = shift @_ ) {
471300ns if ( $param eq '$log' ) {
481200ns $saw_log_param = 1; # defer until later
491400ns next; # singular
50 }
51 else {
52 push @params, $param, shift @_; # pairwise
53 }
54 }
55
5622µs unless ( @params % 2 == 0 ) {
57 require Carp;
58 Carp::croak("Argument list not balanced: @params");
59 }
60
61 # get logger if one was requested
6224µs if ($saw_log_param) {
63252µs220µs
# spent 12µs (5+7) within Log::Any::BEGIN@63 which was called: # once (5µs+7µs) by CHI::Stats::BEGIN@5 at line 63
no strict 'refs';
# spent 12µs making 1 call to Log::Any::BEGIN@63 # spent 7µs making 1 call to strict::unimport
641700ns11.22ms my $proxy = $class->get_logger( category => $caller, @params );
# spent 1.22ms making 1 call to Log::Any::get_logger
651400ns my $varname = "$caller\::log";
6612µs *$varname = \$proxy;
67 }
68}
69
70
# spent 124ms (64.9+59.5) within Log::Any::get_logger which was called 2003 times, avg 62µs/call: # 1001 times (32.3ms+30.2ms) by Search::Elasticsearch::Logger::LogAny::_build_trace_handle at line 28 of Search/Elasticsearch/Logger/LogAny.pm, avg 62µs/call # 1001 times (32.6ms+28.1ms) by Search::Elasticsearch::Logger::LogAny::_build_log_handle at line 18 of Search/Elasticsearch/Logger/LogAny.pm, avg 61µs/call # once (13µs+1.21ms) by Log::Any::_export_to_caller at line 64
sub get_logger {
7120033.19ms my ( $class, %params ) = @_;
722112µs219µs
# spent 12µs (5+7) within Log::Any::BEGIN@72 which was called: # once (5µs+7µs) by CHI::Stats::BEGIN@5 at line 72
no warnings 'once';
# spent 12µs making 1 call to Log::Any::BEGIN@72 # spent 7µs making 1 call to warnings::unimport
73
7420035.72ms20035.56ms my $proxy_class = $class->_get_proxy_class( delete $params{proxy_class} );
# spent 5.56ms making 2003 calls to Log::Any::_get_proxy_class, avg 3µs/call
75 my $category =
7620032.67ms defined $params{category} ? delete $params{'category'} : caller;
77
7820031.10ms if ( my $default = delete $params{'default_adapter'} ) {
79 $class->_manager->set_default( $category, $default );
80 }
81
8220038.33ms400611.2ms my $adapter = $class->_manager->get_adapter( $category );
# spent 8.51ms making 2003 calls to Log::Any::Manager::get_adapter, avg 4µs/call # spent 2.64ms making 2003 calls to Log::Any::_manager, avg 1µs/call
83
8420033.96ms200318.3ms require_dynamic($proxy_class);
# spent 18.3ms making 2003 calls to Log::Any::Adapter::Util::require_dynamic, avg 9µs/call
85200314.5ms200324.5ms return $proxy_class->new(
# spent 24.5ms making 2003 calls to Log::Any::Proxy::new, avg 12µs/call
86 %params, adapter => $adapter, category => $category,
87 );
88}
89
90
# spent 5.56ms within Log::Any::_get_proxy_class which was called 2003 times, avg 3µs/call: # 2003 times (5.56ms+0s) by Log::Any::get_logger at line 74, avg 3µs/call
sub _get_proxy_class {
912003920µs my ( $self, $proxy_name ) = @_;
922003924µs return $Log::Any::OverrideDefaultProxyClass
93 if $Log::Any::OverrideDefaultProxyClass;
94200311.4ms return "Log::Any::Proxy" unless $proxy_name;
95 my $proxy_class = (
96 substr( $proxy_name, 0, 1 ) eq '+'
97 ? substr( $proxy_name, 1 )
98 : "Log::Any::Proxy::$proxy_name"
99 );
100 return $proxy_class;
101}
102
103# For backward compatibility
104sub set_adapter {
105 my $class = shift;
106 Log::Any->_manager->set(@_);
107}
108
10913µs1;
110
111__END__