Commit 7ae76de4 authored by Olav Kvittem's avatar Olav Kvittem

dampening jitter reports not changed, memory bug

parent 6a6ab5ae
......@@ -8,7 +8,7 @@ apt-get update
apt-get -y upgrade
package="mp-rude"
version="1.3.15"
version="1.3.16"
target="${package}_${version}_all"
......
......@@ -19,7 +19,7 @@ use constant JAN_1970 => 0x83aa7e80;
# use LWP::Protocol::https;
# date --date 'jan 1 2000' +%s
$version="0.1.2";
$version="0.1.3";
$min_tx=946681200;
$max_tx=1893452400; # 2030-01-01
$maxseqreorder=1000; #
......@@ -442,21 +442,31 @@ sub gap_type {
}
}
sub get_name{
my $adr=shift;
if ($hostname{$adr}){
$name=$hostname{$adr};
} else {
if ( $hostname = gethostbyaddr(inet_aton($adr), AF_INET) ){
$name=$hostname{$adr}=$hostname;
} else {
$name=$hostname{$adr}=$adr;
}
}
return $name;
}
sub analyze_packet {
my ($seq, $src, $dst, $tx, $rx ) = @_;
if ( $opt_id){
# use that
} elsif ($hostname{$src}){
$id=$hostname{$src};
# use existing # $id=opt_id;
} else {
if ( $hostname = gethostbyaddr(inet_aton($src), AF_INET) ){
$id=$hostname{$src}=$hostname;
} else {
$id=$hostname{$src}=$src;
}
$id=get_name($src);
}
$src_adr{$id}=$src if ! $src_adr{$id} ;
$dst_adr{$id}=$dst if ! $dst_adr{$id} ;
$dst_name{$id}=get_name($dst);
if ($tx < $min_tx || $tx > $max_tx){
$small_tx{$id}++;
......@@ -609,6 +619,7 @@ sub analyze_packet {
$nslep{$id}++;
while ( $nslep{$id} > $maxslep){
shift @{$slep{$id}};
shift @{$slep_data{$id}};
$nslep{$id}--;
}
}
......@@ -699,25 +710,28 @@ sub check_jitter{
$report_type='interval';
}
if ( $report_type eq 'interval' && jitter_change( $id, $jit, $ddelay, $slope50) # periodic or by threshhold
|| ( abs $jit > $min_jit || $ddelay > $min_ddelay || abs $slope_50 > $min_slope ) ){ #
# emit_jitter_json(\$l);
my $json={
"event_type" => "jitter",
"report_type" => $report_type,
"h_n" => $n * 1,
"h_jit" => $jit * 1.0,
"h_ddelay" => $ddelay * 1.0,
"h_delay" => $delay * 1.0,
"h_min_d" => $min_d * 1.0
# "h_slope_10" => $slope_10 * 1.0,
# "h_slope_20" => $slope_20 * 1.0,
# "h_slope_30" => $h_slope_30 * 1.0,
# "h_slope_40" => $h_slope_40 * 1.0,
# "h_slope_50" => $h_slope_50 * 1.0
};
emit_json($json, $id, $tstart);
$jitter_last{$id} = $tstart;
if ( $report_type eq 'interval' # periodic or by threshhold
|| ( abs $jit > $min_jit || $ddelay > $min_ddelay || abs $slope_50 > $min_slope ) ){ #
if (jitter_change( $id, $jit, $ddelay, $slope50 ) ){
# emit_jitter_json(\$l);
my $json={
"event_type" => "jitter",
"report_type" => $report_type,
"h_n" => $n * 1,
"h_jit" => $jit * 1.0,
"h_ddelay" => $ddelay * 1.0,
"h_delay" => $delay * 1.0,
"h_min_d" => $min_d * 1.0
# "h_slope_10" => $slope_10 * 1.0,
# "h_slope_20" => $slope_20 * 1.0,
# "h_slope_30" => $h_slope_30 * 1.0,
# "h_slope_40" => $h_slope_40 * 1.0,
# "h_slope_50" => $h_slope_50 * 1.0
};
emit_json($json, $id, $tstart);
$jitter_last{$id} = $tstart;
}
}
} else { # ignore
}
......@@ -1045,7 +1059,12 @@ sub emit_event_json{
if ( $$line =~ /\d\d\d\d-\d\d-\d\d\s+\d\d:/){ #looks like report line : yyy-mm-dd hh:
my @f=split(/\s+/, $$line);
my $from=$f[$hix{id}];
my $to=`hostname`; chomp($to);
my $o;
if ( $dst_name{$id}){
$to = $dst_name{$id};
} else {
$to=`hostname`; chomp($to);
}
# my ($date, $t)= ( $f[$hix{date}], $f[$hix{time}] );
# my @gt=gmtime $f[$hix{tunix}];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment