#!/opt/ucl/bin/perl $filename = ; $filename2 = "DATA"; $filename3 = "NAKS"; if(!open(TEXTFILE, "../tcpdumps/$filename")) { print STDERR "Can't open file"; } if(!open(TEXTFILE2, "> $filename2")) { print STDERR "Can't open file"; } if(!open(TEXTFILE3, "> $filename3")) { print STDERR "Can't open file"; } $counter = 0; $nakcounter = 50000; $flag = 0; $start = 0; while () { if ($_ =~ /DATA/) { ($first, $second) = split(/len /); ($len) = split(/\s/,$second); $counter = $counter + $len; # $counter = ($counter/1000); print "$counter\n"; ($time) = split(/\s/,$first); ($hour,$min,$second) = split(/:/,$time); $time = (($hour * 3600) + ($min * 60) + $second); if($flag == 0) { $start = $time; $flag = 1; } $time = $time - $start; print TEXTFILE2 "$time\t$counter\n"; } if (($_ =~ /NAK/)&($flag == 1)) { #$nakcounter = $nakcounter + 10000; ($time) = split(/\s/); ($hour,$min,$second) = split(/:/,$time); $time = (($hour * 3600) + ($min * 60) + $second); $time = $time - $start; print TEXTFILE3 "$time\t$nakcounter\n"; } } $throughput = (($counter/$time) * 8)/1000000; print "\n\nThroughput is: $throughput Mbit/s\n";