BEGIN {
send = 0;
recv = 0;
packetsize = 0;
st = 0;
ft = 0;
linecount=0;
throughput=0;
TotalDelay = 0.0 ;
packetid=0;
}
{
rTime=$2
packetid=$6
if ( $1 == "s" && $7 !="ack" )
{
rSentTime[ packetid ] = rTime ;
send++;
}
if ( lineCount==0 )
{
st = $2;
lineCount++;
}
else
{
ft = $2;
}
if ( $1 == "r" && $7 != "ack" )
{
recv++;
packetsize=$8
rReceivedTime[ idPacket ] = rTime ;
TotalDelay += ReceivedTime[ packetid] - SentTime[ packetid ];
}
}
END {
print "packetsize\t\t\t" packetsize
totaltime=ft-st
throughput=(recv*packetsize)/totaltime
print "total simulation time\t\t" totaltime
print "No of pkts send \t\t" send
print "No of pkts recv \t\t" recv
print "Pkt delivery ratio \t\t" recv/send
print "Throughput \t\t\t" int(throughput)
}
send = 0;
recv = 0;
packetsize = 0;
st = 0;
ft = 0;
linecount=0;
throughput=0;
TotalDelay = 0.0 ;
packetid=0;
}
{
rTime=$2
packetid=$6
if ( $1 == "s" && $7 !="ack" )
{
rSentTime[ packetid ] = rTime ;
send++;
}
if ( lineCount==0 )
{
st = $2;
lineCount++;
}
else
{
ft = $2;
}
if ( $1 == "r" && $7 != "ack" )
{
recv++;
packetsize=$8
rReceivedTime[ idPacket ] = rTime ;
TotalDelay += ReceivedTime[ packetid] - SentTime[ packetid ];
}
}
END {
print "packetsize\t\t\t" packetsize
totaltime=ft-st
throughput=(recv*packetsize)/totaltime
print "total simulation time\t\t" totaltime
print "No of pkts send \t\t" send
print "No of pkts recv \t\t" recv
print "Pkt delivery ratio \t\t" recv/send
print "Throughput \t\t\t" int(throughput)
}
save the above code as awkfilename.awk
run as
open terminal window if u are using linux os
ns aodv.tcl
nam will be created......
aodv.tr will be generated....
awk -f awkfilename.awk aodv.tr
why my packt size become -Ni ?
ReplyDelete