Révision 285c11cd
Fixed undefined variable use and division by zero in redis plugin
| plugins/redis/redis_ | ||
|---|---|---|
| 76 | 76 |
my $hash; |
| 77 | 77 |
foreach (split(/\r\n/, $rep)) {
|
| 78 | 78 |
my ($key,$val) = split(/:/, $_, 2); |
| 79 |
$hash->{$key} = $val;
|
|
| 79 |
if (defined($key)) {
|
|
| 80 |
$hash->{$key} = $val;
|
|
| 81 |
} |
|
| 80 | 82 |
} |
| 81 | 83 |
close ($sock); |
| 82 | 84 |
|
| ... | ... | |
| 136 | 138 |
} |
| 137 | 139 |
|
| 138 | 140 |
my $total = $hash->{'keyspace_hits'} + $hash->{'keyspace_misses'};
|
| 139 |
printf("hitratio.value %.2f\n", $hash->{'keyspace_hits'} / $total * 100);
|
|
| 140 |
printf("missratio.value %.2f\n", $hash->{'keyspace_misses'} / $total * 100);
|
|
| 141 |
my $hitratio = 0; |
|
| 142 |
my $missratio = 0; |
|
| 143 |
if ($total > 0) {
|
|
| 144 |
$hitratio = $hash->{'keyspace_hits'} / $total * 100;
|
|
| 145 |
$missratio = $hash->{'keyspace_misses'} / $total * 100;
|
|
| 146 |
} |
|
| 147 |
printf("hitratio.value %.2f\n", $hitratio);
|
|
| 148 |
printf("missratio.value %.2f\n", $missratio);
|
|
| 141 | 149 |
} |
| 142 | 150 |
|
| 143 | 151 |
|
Formats disponibles : Unified diff