summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Smokeping/matchers/Median.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Smokeping/matchers/Median.pm b/lib/Smokeping/matchers/Median.pm
index 24be199..35953dd 100644
--- a/lib/Smokeping/matchers/Median.pm
+++ b/lib/Smokeping/matchers/Median.pm
@@ -85,6 +85,9 @@ sub Test($$)
my $ac = $self->{param}{old};
my $bc = $self->{param}{new};
my $cc = $ac +$bc;
+ my $count = scalar @{$data->{rtt};
+ $cc = $count if $count < $cc;
+ $bc = $count if $count < $bc;
my $oldm = robust_median(@{$data->{rtt}}[-$cc..-$bc-1]);
my $newm = robust_median(@{$data->{rtt}}[-$bc..-1]);
return abs($oldm-$newm) > $self->{param}{diff};