Skip to content
Snippets Groups Projects
Commit 7936160a authored by Robert Ricci's avatar Robert Ricci
Browse files

Now sticks stddev and packet loss rates into the database

parent 9bb4ae1b
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ sub upload_times($$$) { ...@@ -76,7 +76,7 @@ sub upload_times($$$) {
my $suceeded = 0; my $suceeded = 0;
my $failed = 0; my $failed = 0;
foreach my $time (@times) { foreach my $time (@times) {
my ($src,$dst,$latency) = @$time; my ($src,$dst,$latency,$stddev,$lossrate) = @$time;
if (!$ipmap{$src}) { if (!$ipmap{$src}) {
warn "Got an IP ($src) that's not in the interfaces table\n"; warn "Got an IP ($src) that's not in the interfaces table\n";
$failed++; $failed++;
...@@ -107,7 +107,8 @@ sub upload_times($$$) { ...@@ -107,7 +107,8 @@ sub upload_times($$$) {
DBQueryFatal("replace into widearea_recent set IP1='$src'," . DBQueryFatal("replace into widearea_recent set IP1='$src'," .
" IP2='$dst', time=$latency, node_id1='$node_id1', " . " IP2='$dst', time=$latency, node_id1='$node_id1', " .
" iface1='$iface1', node_id2='$node_id2', iface2='$iface2', " . " iface1='$iface1', node_id2='$node_id2', iface2='$iface2', " .
" bandwidth=$bandwidth"); " bandwidth=$bandwidth, time_stddev='$stddev', " .
" lossrate='$lossrate'");
} }
...@@ -189,16 +190,18 @@ sub get_times($) { ...@@ -189,16 +190,18 @@ sub get_times($) {
my @return; my @return;
foreach my $line (@data) { foreach my $line (@data) {
chomp $line; chomp $line;
if (! ($line =~ /(\d+\.\d+.\d+\.\d+)\s+(\d+\.\d+.\d+\.\d+)\s+(\d+.\d+)\s+(\d+)\s+(\d+)/) ) { if (! ($line =~ /(\d+\.\d+.\d+\.\d+)\s+(\d+\.\d+.\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+)\s+(\d+)/) ) {
warn "Bad data line: $line\n"; warn "Bad data line: $line\n";
next; next;
} }
my ($src,$dst,$avg,$successful,$unsuccessful) = ($1,$2,$3,$4,$5); my ($src,$dst,$avg,$stddev,$successful,$unsuccessful)
= ($1,$2,$3,$4,$5,$6);
if ($successful > 0) { if ($successful > 0) {
push @return, [$src,$dst,$avg]; my $lossrate = ($unsuccessful*1.0)/($successful + $unsuccessful);
push @return, [$src,$dst,$avg,$stddev,$lossrate];
} elsif ($unsuccessful > 0) { } elsif ($unsuccessful > 0) {
push @return, [$src,$dst,undef]; push @return, [$src,$dst,undef,$stddev,1];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment