]> rtime.felk.cvut.cz Git - frescor/fwp.git/blob - wme_test/sat_per_packet_size/sat-graph
Merge branch 'master' of rtime.felk.cvut.cz:frescor/fwp
[frescor/fwp.git] / wme_test / sat_per_packet_size / sat-graph
1 #!/usr/bin/perl -w
2
3 $pdf_output=1;
4 $multiple_graphs=1 if ($#ARGV >= 0 && $ARGV[0] eq "-m");
5
6 #$Q=$ARGV[0] || "VI";
7
8 foreach $Q (("VO", "VI", "BE")) {
9     
10     $base_name="${Q}_packet_size_";
11     $graph_data_name = "${base_name}graph";
12
13     open G, ">$graph_data_name" || die "error opening $graph_data_name";
14     foreach $f (glob "${base_name}*.dat") {
15         open F, $f;
16         while (<F>) {
17             if (/AC_${Q}/) {
18                 ($a) = /([0-9]*) bytes/;
19                 ($b)=/real: +([0-9.]+) kbps/;
20             }
21             if (/AC_BE/) {
22                 ($c) = /real: +([0-9.]+) kbps/;
23                 if (!$c) {
24                     ($c) = /real: +([0-9.]+) bps/;
25                     $c/=1000.0;
26                 }
27                 print G "$a $b $c\n";
28             }
29         }
30         close F;    
31     }
32     close G;
33 }
34 if ($pdf_output) {
35     if ($multiple_graphs) {
36         $pdf = "packet_sizes_sat.pdf";
37     } else {
38         $pdf = "packet_sizes_sat_comp.pdf";
39     }
40     open GNUPLOT, "|gnuplot|ps2pdf - $pdf";
41     print GNUPLOT "set term postscript color landscape\n";
42 } else {
43     open GNUPLOT, "|gnuplot -persist";
44 }
45
46 print GNUPLOT <<EOF;
47 #set key off
48 set key right bottom nobox
49 set style data linespoints
50 set grid
51 EOF
52
53 if ($multiple_graphs) {
54     foreach $Q (("VO", "VI", "BE")) {
55         $base_name="${Q}_packet_size_";
56         $graph_data_name = "${base_name}graph";
57         
58         print GNUPLOT qq/set title "Influence of AC_$Q packet sizes to saturation bandwidth of AC_BE"\n/;
59         print GNUPLOT qq/set xlabel "AC_$Q packet sizes [bytes]"\n/;
60         print GNUPLOT qq/set ylabel "Bandwidth [kbps]"\n/;
61         print GNUPLOT qq/plot /;
62         if ($Q ne "BE") {
63             print GNUPLOT qq/"$graph_data_name" using 1:3 title "AC_BE", /;
64         }
65         print GNUPLOT qq/"$graph_data_name" using 1:2 title "AC_${Q}"\n/;
66     }
67 } else {
68     print GNUPLOT qq/set title "Influence of different packet sizes to saturation bandwidth of AC_BE"\n/;
69     print GNUPLOT qq/set xlabel "Packet sizes [bytes]"\n/;
70     print GNUPLOT qq/set ylabel "AC_BE bandwidth [kbps]"\n/;
71     @plots=();
72     foreach $Q (("VO", "VI", "BE")) {
73         $base_name="${Q}_packet_size_";
74         $graph_data_name = "${base_name}graph";
75         
76         push @plots, qq/"$graph_data_name" using 1:3 title "packet size of AC_${Q} was being changed"/;
77     }
78     print GNUPLOT "plot ", join(", ", @plots), "\n";
79 }
80     
81 close GNUPLOT;