| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::RedisTop::Component::DB; |
|
2
|
2
|
|
|
2
|
|
1962
|
use base 'App::RedisTop::Component'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
517
|
|
|
3
|
|
|
|
|
|
|
sub new { |
|
4
|
1
|
|
|
1
|
0
|
2
|
my $class = shift; |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
|
|
11
|
my $self = bless { |
|
7
|
|
|
|
|
|
|
group => 'db', |
|
8
|
|
|
|
|
|
|
items => [ |
|
9
|
|
|
|
|
|
|
{ name => 'keys', stat_key => 'keys', }, |
|
10
|
|
|
|
|
|
|
{ name => 'expires', stat_key => 'expires', }, |
|
11
|
|
|
|
|
|
|
], |
|
12
|
|
|
|
|
|
|
width => 7, |
|
13
|
|
|
|
|
|
|
unit => 1, |
|
14
|
|
|
|
|
|
|
total => 1, |
|
15
|
|
|
|
|
|
|
dbid => 0, |
|
16
|
|
|
|
|
|
|
@_, |
|
17
|
|
|
|
|
|
|
}, $class; |
|
18
|
|
|
|
|
|
|
# set group name |
|
19
|
1
|
|
|
|
|
31
|
$self->{group} = $self->{group} . $self->{dbid}; |
|
20
|
1
|
|
|
|
|
15
|
$self; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# override |
|
24
|
|
|
|
|
|
|
sub stat_values { |
|
25
|
1
|
|
|
1
|
0
|
4
|
my ($self, $stat) = @_; |
|
26
|
1
|
|
|
|
|
2
|
my @results; |
|
27
|
1
|
|
|
|
|
4
|
my $db_key = "db" . $self->{dbid}; |
|
28
|
1
|
|
50
|
|
|
4
|
my $value = $stat->{$db_key} || "keys=0,expires=0"; |
|
29
|
1
|
|
|
|
|
2
|
my ($keys, $expires) = map {$_ =~ /keys=(\d+),expires=(\d+)/; $1, $2} ($value); |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
5
|
|
|
30
|
1
|
|
|
|
|
4
|
return ($keys, $expires); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |