From: Michal Sojka Date: Wed, 11 Nov 2009 15:41:34 +0000 (+0100) Subject: fwp-timing: Final version and a simple gnuplot script X-Git-Url: http://rtime.felk.cvut.cz/gitweb/frescor/fwp.git/commitdiff_plain/827cac2127349b1e99dfdd6aa9b8494c7e14be03 fwp-timing: Final version and a simple gnuplot script --- diff --git a/fwp/tests/timing/fwp-timing.c b/fwp/tests/timing/fwp-timing.c index 941a8f3..953ac1f 100644 --- a/fwp/tests/timing/fwp-timing.c +++ b/fwp/tests/timing/fwp-timing.c @@ -444,11 +444,11 @@ void *sender(void *arg) 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 @@ -511,9 +511,8 @@ int main(int argc, char *argv[]) goto destroy; } - for (i=0; ithread, NULL, sender, p[i]); - } while (!exit_flag && !opt_quiet) { int v; @@ -524,10 +523,10 @@ int main(int argc, char *argv[]) usleep(100000); } + for (i=0; ithread, NULL); destroy: for (i=0; ithread, NULL); frsh_contract_cancel(p[i]->vres); free(p[i]); } @@ -535,5 +534,5 @@ destroy: stats.lost = stats.sent - stats.received; print_stat(true); - return 0; + return negotiation_failure ? 1 : 0; } diff --git a/fwp/tests/timing/fwp-timing.gnuplot b/fwp/tests/timing/fwp-timing.gnuplot new file mode 100644 index 0000000..721a050 --- /dev/null +++ b/fwp/tests/timing/fwp-timing.gnuplot @@ -0,0 +1,11 @@ +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 diff --git a/fwp/tests/timing/fwp-timing.pl b/fwp/tests/timing/fwp-timing.pl index 36afde5..2232f53 100755 --- a/fwp/tests/timing/fwp-timing.pl +++ b/fwp/tests/timing/fwp-timing.pl @@ -29,7 +29,7 @@ $SIG{TERM} = \&catch_zap; $max=10; $max=$ARGV[0] if (scalar(@ARGV)); - +my @results=(); for($i=1; $i<=$max; $i++) { $|++; # Autoflush printf "%3d: ", $i; @@ -40,9 +40,23 @@ for($i=1; $i<=$max; $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;