| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Log/Log4perl/MDC.pm |
| Statements | Executed 11 statements in 176µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 19µs | 19µs | Log::Log4perl::MDC::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 12µs | Log::Log4perl::MDC::BEGIN@6 |
| 1 | 1 | 1 | 6µs | 14µs | Log::Log4perl::MDC::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::MDC::get |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::MDC::get_context |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::MDC::put |
| 0 | 0 | 0 | 0s | 0s | Log::Log4perl::MDC::remove |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ################################################## | ||||
| 2 | package Log::Log4perl::MDC; | ||||
| 3 | ################################################## | ||||
| 4 | |||||
| 5 | 3 | 28µs | 1 | 19µs | # spent 19µs within Log::Log4perl::MDC::BEGIN@5 which was called:
# once (19µs+0s) by Log::Log4perl::Layout::PatternLayout::BEGIN@17 at line 5 # spent 19µs making 1 call to Log::Log4perl::MDC::BEGIN@5 |
| 6 | 3 | 16µs | 2 | 18µs | # spent 12µs (7+6) within Log::Log4perl::MDC::BEGIN@6 which was called:
# once (7µs+6µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@17 at line 6 # spent 12µs making 1 call to Log::Log4perl::MDC::BEGIN@6
# spent 6µs making 1 call to strict::import |
| 7 | 3 | 130µs | 2 | 21µs | # spent 14µs (6+7) within Log::Log4perl::MDC::BEGIN@7 which was called:
# once (6µs+7µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@17 at line 7 # spent 14µs making 1 call to Log::Log4perl::MDC::BEGIN@7
# spent 7µs making 1 call to warnings::import |
| 8 | |||||
| 9 | 1 | 500ns | our %MDC_HASH = (); | ||
| 10 | |||||
| 11 | ########################################### | ||||
| 12 | sub get { | ||||
| 13 | ########################################### | ||||
| 14 | my($class, $key) = @_; | ||||
| 15 | |||||
| 16 | if($class ne __PACKAGE__) { | ||||
| 17 | # Somebody called us with Log::Log4perl::MDC::get($key) | ||||
| 18 | $key = $class; | ||||
| 19 | } | ||||
| 20 | |||||
| 21 | if(exists $MDC_HASH{$key}) { | ||||
| 22 | return $MDC_HASH{$key}; | ||||
| 23 | } else { | ||||
| 24 | return undef; | ||||
| 25 | } | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | ########################################### | ||||
| 29 | sub put { | ||||
| 30 | ########################################### | ||||
| 31 | my($class, $key, $value) = @_; | ||||
| 32 | |||||
| 33 | if($class ne __PACKAGE__) { | ||||
| 34 | # Somebody called us with Log::Log4perl::MDC::put($key, $value) | ||||
| 35 | $value = $key; | ||||
| 36 | $key = $class; | ||||
| 37 | } | ||||
| 38 | |||||
| 39 | $MDC_HASH{$key} = $value; | ||||
| 40 | } | ||||
| 41 | |||||
| 42 | ########################################### | ||||
| 43 | sub remove { | ||||
| 44 | ########################################### | ||||
| 45 | %MDC_HASH = (); | ||||
| 46 | |||||
| 47 | 1; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | ########################################### | ||||
| 51 | sub get_context { | ||||
| 52 | ########################################### | ||||
| 53 | return \%MDC_HASH; | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | 1 | 2µs | 1; | ||
| 57 | |||||
| 58 | __END__ |