File: testFRp_tcp.pl

package info (click to toggle)
ns2 2.35%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,864 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 818; awk: 525; csh: 355
file content (38 lines) | stat: -rwxr-xr-x 674 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
#!/usr/bin/perl -w

use strict 'refs';
use strict 'subs';

if ($#ARGV != 2) {
  &usage;
  exit;
}

sub usage {
  print STDERR " usage: $0 <pattern> <probability> <time>\n";
  exit;
}

my $targetRTT = 0.040;
my $p = $ARGV[1];
my @a = <$ARGV[0]*>;
my $time = $ARGV[2] - 10;

my $frp = sqrt(1.5)/($targetRTT*sqrt($p));
print STDERR "frp = $frp \n";

foreach $file (@a) {

  my ($pre1, $pre2, $suffix) = split(/-/,$file);
  my $x = $suffix;

  print STDERR "Doing $file $suffix\n";
  
  my $command = "awk \'{if (\$4==1) { if (\$2==50) start = \$6; if(\$2==$time) print $x, (\$6-start)/\(($time-50)*1000*$frp\)}}\' $file";

# print "$command", "\n";
 system($command);  

}