void print_stat(bool final)
{
- printf("Sent: %5d Received: %5d Lost: %5d Max: %6.3f ms",
+ printf("Sent: %5d Received: %5d Lost: %5d Max: %8.3f ms",
stats.sent, stats.received, stats.lost, hist.max/1000.0);
if (final) {
- printf(" Max: %6.3f ms 90%%: %6.3f ms\n",
- hist_get_percentile(&hist, 100)/1000.0,
+ printf(" Packetloss: %7.3f %% 90%%: %8.3f ms\n",
+ 100.0*stats.lost/stats.sent,
hist_get_percentile(&hist, 90)/1000.0);
}
else
goto destroy;
}
- for (i=0; i<num; i++) {
+ for (i=0; i<num; i++)
pthread_create(&p[i]->thread, NULL, sender, p[i]);
- }
while (!exit_flag && !opt_quiet) {
int v;
usleep(100000);
}
+ for (i=0; i<num; i++)
+ pthread_join(p[i]->thread, NULL);
destroy:
for (i=0; i<num; i++) {
- if (!negotiation_failure)
- pthread_join(p[i]->thread, NULL);
frsh_contract_cancel(p[i]->vres);
free(p[i]);
}
stats.lost = stats.sent - stats.received;
print_stat(true);
- return 0;
+ return negotiation_failure ? 1 : 0;
}
--- /dev/null
+set xlabel "Number of simultaneous streams"
+set ylabel "Time [ms]
+set yrange [0:]
+set y2range [0:100]
+set y2label "Packet loss [%]
+set y2tics
+set grid
+
+plot "./fwp-timing.dat" using 1:2 title "Maximal delay [ms]" with lp,\
+ "./fwp-timing.dat" using 1:4 title "90% [ms]" with lp,\
+ "./fwp-timing.dat" using 1:3 title "Packet loss [%]" with lp axis x1y2
$max=10;
$max=$ARGV[0] if (scalar(@ARGV));
-
+my @results=();
for($i=1; $i<=$max; $i++) {
$|++; # Autoflush
printf "%3d: ", $i;
my $n = ($i-1) / @srcdst + ((($j % @srcdst) <= (($i-1) % @srcdst)) ? 1 : 0);
$streams[$j] = $srcdst[$j]." -n $n" if ($n);
}
- $cmd="$omk_rules_dir/_compiled/bin-tests/fwp-timing -l 2 -q -c 10 ".join(" -/ ", @streams);
+ $cmd="$omk_rules_dir/_compiled/bin-tests/fwp-timing -l 2 -q -c 1000 ".join(" -/ ", @streams);
#print "$cmd\n";
$out=`$cmd`;
print $out;
+ my @result;
+ if ($? == 0) {
+ @result = $out =~ /Max: *([0-9.]+).*Packetloss: *([0-9.]+).*90%: *([0-9.]+)/;
+ } else {
+ @result = ();
+ }
+ $results[$i] = \@result;
}
+# Print data for gnuplot
+open(DAT, ">", "fwp-timing.dat");
+for($i=1; $i<=$max; $i++) {
+ my $line = "$i ".join(" ", @{$results[$i]})."\n";
+ print DAT $line;
+}
+close DAT;