Debian Codegraph @

tcl/ex/red-pd/testFRp_tcp/testFRp_tcp.pl

raw
1 #!/usr/bin/perl -w
2
3 use strict 'refs';
4 use strict 'subs';
5
6 if ($#ARGV != 2) {
7 &usage;
8 exit;
9 }
10
11 sub usage {
12 print STDERR " usage: $0 <pattern> <probability> <time>\n";
13 exit;
14 }
15
16 my $targetRTT = 0.040;
17 my $p = $ARGV[1];
18 my @a = <$ARGV[0]*>;
19 my $time = $ARGV[2] - 10;
20
21 my $frp = sqrt(1.5)/($targetRTT*sqrt($p));
22 print STDERR "frp = $frp \n";
23
24 foreach $file (@a) {
25
26 my ($pre1, $pre2, $suffix) = split(/-/,$file);
27 my $x = $suffix;
28
29 print STDERR "Doing $file $suffix\n";
30
31 my $command = "awk \'{if (\$4==1) { if (\$2==50) start = \$6; if(\$2==$time) print $x, (\$6-start)/\(($time-50)*1000*$frp\)}}\' $file";
32
33 # print "$command", "\n";
34 system($command);
35
36 }
37
38