| 1 | package App::RedisTop::Component::DB; | ||||||||||||
| 2 | 2 | ▶ | use base 'App::RedisTop::Component'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 1 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 4 | 1 | my $class = shift; | |||||||||||
| 5 | |||||||||||||
| 6 | 1 | 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 | $self->{group} = $self->{group} . $self->{dbid}; | |||||||||||
| 20 | 1 | $self; | |||||||||||
| 21 | } | ||||||||||||
| 22 | |||||||||||||
| 23 | # override | ||||||||||||
| 24 | 1 | ▶ | sub stat_values { | ||||||||||
|
Subroutine
stat_values: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 25 | 1 | my ($self, $stat) = @_; | |||||||||||
| 26 | 1 | my @results; | |||||||||||
| 27 | 1 | my $db_key = "db" . $self->{dbid}; | |||||||||||
| 28 | 1 | ▶ | my $value = $stat->{$db_key} || "keys=0,expires=0"; | ||||||||||
|
Condition50%1/2
$stat->{$db_key} || 'keys=0,expires=0'
MC/DC0%0/1
$stat->{$db_key} || 'keys=0,expires=0'
$stat->{$db_key}
Truth table50%1/2
A
A= $stat->{$db_key}
| |||||||||||||
| 29 | 1 | my ($keys, $expires) = map {$_ =~ /keys=(\d+),expires=(\d+)/; $1, $2} ($value); | |||||||||||
| 30 | 1 | return ($keys, $expires); | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 2 | 1; | |||||||||||