[Smac-users] goodput about SMAC
=?GB2312?B?zO/D9w==?=
tianm.www at gmail.com
Thu Mar 29 03:32:28 PDT 2007
Hi to all, I am trying to trace the goodput(throughput) of two wireless
nodes communicating with each other using the SMAC protocol implemented in
ns2. The two nodes are within the transmission range of each other and
sending ping messages to each other. First i will simulate it in ns2, and
then get the information about the goodput using gawk.But i am not sure how
to calculate the goodput using awk, is any body has the awk file about this
?
the following is my code, is there any error?
BEGIN {
packet_byte=0;
packet_losts =0;
}
$1 ~/r/ {
#goodput
if(match($4,"AGT") && match($7,"tcp") )
{
packet_byte = packet_byte + $8;
}
if(match($4,"AGT") && match($7,"ack") )
{
packet_byte = packet_byte + $8;
}
}
$1 ~/D/ {
if(match($4,"RTR") && match($5,"CBK") && match($7,"tcp"))
{
packet_losts = packet_losts + 1;
}
}
END {
goodput = (packet_byte*8.0)/1024/1024/50; #Mbps
printf "%d\t%d\t%d\t%f\n",nodes_num,packet_losts,nodes_num/2,goodput >>
outfile;
}
and the trace file are like this :
r 45.123933000 _0_ MAC --- 0 CTS 38 [52ac 0 0 0]
s 45.123943000 _0_ MAC --- 9 tcp 2612 [102 1 0 800] ------- [0:0 1:0 30 1]
[6 0] 0 0
r 45.144839500 _1_ MAC --- 9 tcp 2560 [102 1 0 800] ------- [0:0 1:0 30 1]
[6 0] 1 0
s 45.144849500 _1_ MAC --- 0 ACK 38 [0 0 0 0]
r 45.144864500 _1_ AGT --- 9 tcp 2560 [102 1 0 800] ------- [0:0 1:0 30 1]
[6 0] 1 0
s 45.144864500 _1_ AGT --- 13 ack 40 [0 0 0 0] ------- [1:0 0:0 32 0] [6 0]
0 0
r 45.145098000 _0_ MAC --- 0 ACK 38 [0 0 0 0]
Thanks a lot
Ming,
Computer Science and Technology
JiLin University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.isi.edu/pipermail/smac-users/attachments/20070329/3f169114/attachment.html
More information about the Smac-users
mailing list