tcl/ex/red-pd/response/response.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 <file> <p> <rtt>\n"; |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | my $file = $ARGV[0]; |
| 17 | my $p = $ARGV[1]; |
| 18 | my $rtt = $ARGV[2]; |
| 19 | |
| 20 | my $frpBW = sqrt(1.5)/($rtt*sqrt($p))*1000; |
| 21 | |
| 22 | my $cmd = "awk \'{if (\$4==1) {bw = (\$6 - old)/$frpBW; print \$2, bw; old=\$6}}\' $file"; |
| 23 | #print STDERR "$cmd\n"; |
| 24 | |
| 25 | system($cmd); |