| 1 | package Plack::Middleware::Profiler::KYTProf::Profile::KVS; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | sub load { | ||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 6 | 1 | my $class = shift; | |||||||||
| 7 | 1 | $class->_add_kvs_profs; | |||||||||
| 8 | } | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub _add_kvs_profs { | ||||||||
|
Subroutine
_add_kvs_profs: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | my $class = shift; | |||||||||
| 12 | 1 | $class->_add_redis_prof; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | sub _add_redis_prof { | ||||||||
|
Subroutine
_add_redis_prof: called CC=3 SCAR=18.2
| |||||||||||
| 16 | 1 | my $class = shift; | |||||||||
| 17 | |||||||||||
| 18 | 1 | for my $method ( | |||||||||
| 19 | qw/ | ||||||||||
| 20 | set get incr decr exists del type | ||||||||||
| 21 | rpush lpush llen lrange ltrim lindex lset lrem lpop rpop | ||||||||||
| 22 | sadd scard sismember smembers spop srem sort | ||||||||||
| 23 | / | ||||||||||
| 24 | ) | ||||||||||
| 25 | { | ||||||||||
| 26 | Devel::KYTProf->add_prof( | ||||||||||
| 27 | 'Redis', $method, | ||||||||||
| 28 | 0 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 0 | my ( $orig, $self, $key ) = @_; | |||||||||
| 30 | return [ | ||||||||||
| 31 | 0 | '%s %s', | |||||||||
| 32 | ['redis_method', 'redis_key'], | ||||||||||
| 33 | { | ||||||||||
| 34 | redis_method => $method, | ||||||||||
| 35 | redis_key => $key, | ||||||||||
| 36 | }, | ||||||||||
| 37 | ]; | ||||||||||
| 38 | } | ||||||||||
| 39 | 24 | ); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 1 | for my $method_multi (qw/ mget /) { | |||||||||
| 43 | Devel::KYTProf->add_prof( | ||||||||||
| 44 | 'Redis', | ||||||||||
| 45 | $method_multi, | ||||||||||
| 46 | 0 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 47 | 0 | my ( $orig, $self, @args ) = @_; | |||||||||
| 48 | 0 | ▶ | if ( ref $args[0] eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | return [ | ||||||||||
| 50 | '%s %s', | ||||||||||
| 51 | ['redis_method', 'redis_key'], | ||||||||||
| 52 | { | ||||||||||
| 53 | redis_method => $method_multi, | ||||||||||
| 54 | 0 | redis_key => join( ', ', map { $_->[0] } @args), | |||||||||
| 55 | }, | ||||||||||
| 56 | ]; | ||||||||||
| 57 | } | ||||||||||
| 58 | else { | ||||||||||
| 59 | return [ | ||||||||||
| 60 | '%s %s', | ||||||||||
| 61 | ['redis_method', 'redis_key'], | ||||||||||
| 62 | { | ||||||||||
| 63 | redis_method => $method_multi, | ||||||||||
| 64 | 0 | ▶ | redis_key => join( ', ', map {ref($_) eq 'ARRAY' ? join(', ',@$_) : $_} @args), | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | }, | ||||||||||
| 66 | ]; | ||||||||||
| 67 | } | ||||||||||
| 68 | } | ||||||||||
| 69 | 1 | ); | |||||||||
| 70 | } | ||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 2 | 1; | |||||||||