| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::Middleware::Profiler::KYTProf::Profile::KVS; |
|
2
|
2
|
|
|
2
|
|
1151
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
84
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
966
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub load { |
|
6
|
1
|
|
|
1
|
0
|
2
|
my $class = shift; |
|
7
|
1
|
|
|
|
|
5
|
$class->_add_kvs_profs; |
|
8
|
|
|
|
|
|
|
} |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _add_kvs_profs { |
|
11
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
|
12
|
1
|
|
|
|
|
4
|
$class->_add_redis_prof; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _add_redis_prof { |
|
16
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
3
|
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
|
|
|
|
|
|
|
sub { |
|
29
|
0
|
|
|
0
|
|
0
|
my ( $orig, $self, $key ) = @_; |
|
30
|
|
|
|
|
|
|
return [ |
|
31
|
0
|
|
|
|
|
0
|
'%s %s', |
|
32
|
|
|
|
|
|
|
['redis_method', 'redis_key'], |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
|
|
|
|
|
|
redis_method => $method, |
|
35
|
|
|
|
|
|
|
redis_key => $key, |
|
36
|
|
|
|
|
|
|
}, |
|
37
|
|
|
|
|
|
|
]; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
24
|
|
|
|
|
12351
|
); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
470
|
for my $method_multi (qw/ mget /) { |
|
43
|
|
|
|
|
|
|
Devel::KYTProf->add_prof( |
|
44
|
|
|
|
|
|
|
'Redis', |
|
45
|
|
|
|
|
|
|
$method_multi, |
|
46
|
|
|
|
|
|
|
sub { |
|
47
|
0
|
|
|
0
|
|
|
my ( $orig, $self, @args ) = @_; |
|
48
|
0
|
0
|
|
|
|
|
if ( ref $args[0] eq 'ARRAY' ) { |
|
49
|
|
|
|
|
|
|
return [ |
|
50
|
0
|
|
|
|
|
|
'%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
|
0
|
0
|
|
|
|
|
'%s %s', |
|
61
|
|
|
|
|
|
|
['redis_method', 'redis_key'], |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
|
|
|
|
|
|
redis_method => $method_multi, |
|
64
|
0
|
|
|
|
|
|
redis_key => join( ', ', map {ref($_) eq 'ARRAY' ? join(', ',@$_) : $_} @args), |
|
65
|
|
|
|
|
|
|
}, |
|
66
|
|
|
|
|
|
|
]; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
1
|
|
|
|
|
9
|
); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |