File: prettyplot.pl

package info (click to toggle)
ns2 2.35%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,796 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (69 lines) | stat: -rw-r--r-- 1,707 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/perl

#get arguments prettyplot.pl <strat> <infilename> <outfile> <legend-flag> 

$strat = shift;
$infile = shift;
$outfile = shift;
$flag = shift;

$legend = "LEGEND: \n
All thruputs are in bits per sec \n
A = TCP Thruput = TCP bytes recvd / run time\n
B = Normalised TCP Thruput = TCP bytes recvd / on time\n
C = Link Thruput = Link bytes recvd / run time \n
D = Normalised Link Thruput = Link bytes recvd / ontime \n
sd = Corresponding standard deviation\n
Normalised link rate = Link rate * ontime / simtime\n\n";



open(DATA, "$infile") || die "Can't open $infile\n";
open(LOG, ">>$outfile") || die "Can't open $outfile\n";

$n=0;
while ($temp = <DATA>) {
    chomp($temp);

    ($retry[$n],$ontime, $A[$n],$A_sd[$n],$B[$n],$B_sd[$n],$C[$n],$C_sd[$n],$D[$n],$D_sd[$n],$n_link_rate) = split " ", $temp;

    #$n_link_rate = @line[10];
    #$ontime = @line[1];
    #$retry[$n] = @line[0];
    #$A[$n] = @line[2];
    #$A_sd[$n] = @line[3];
    #$B[$n] = @line[4];
    #$B_sd[$n] = @line[5];
    #$C[$n] = @line[6];
    #$C_sd[$n] = @line[7];
    #$D[$n] = @line[8];
    #$D_sd[$n] = @line[9];

    $n++;
}

if ($flag == 1) {
    legend();
}


print LOG "\n\nNormalised_Link_Rate = $n_link_rate bps
On_time = $ontime\n
$strat\n\n";

print LOG "#N    A      A_sd     B      B_sd    C      C_sd     D     D_sd\n";

for($i = 0; $i < $n; $i++) { 
    printf LOG "%-5s %-6d %-6d %-6d %-6d %-6d %-6d %-8d %-8d\n", $retry[$i],$A[$i],$A_sd[$i],$B[$i],$B_sd[$i],$C[$i],$C_sd[$i],$D[$i],$D_sd[$i];
    #$str = pack("A5" x 9 , $retry[$i],$A[$i],$A_sd[$i],$B[$i],$B_sd[$i],$C[$i],$C_sd[$i],$D[$i],$D_sd[$i]);
    #print LOG "$str\n";

}


close(LOG);
close(DATA);

sub legend { 
    print LOG $legend; 
}