Dear Sir,

Don't worry about that, I will help you step by step to get the correct 
results, firstly use the attach awk script to extract results from you 
simulation output file using the command: 
awk -f metrics.awk out.tr 
and let me see the results, if its not worked well, there is another soultion..

Regards,
Mohammed AbuHajar
MSc Computer Science
University of Northern Virginia



----- Original Message ----
From: adi suryo wibowo <[EMAIL PROTECTED]>
To: Mohammed Abu Hajar <[EMAIL PROTECTED]>; NS2 <ns-users@isi.edu>
Sent: Saturday, December 1, 2007 12:19:46 AM
Subject: Fwd: help me fix this trace

Hii ns-User

I was read in ns mailing list and I found your name in contribute helping other 
peoples.
I truly need your help..
I was simulated my tcl script in ns2.30 using new_trace format
I have out.tr then I want to calculate 3 performance metric :
paket delivery ratio, normalized overhead and end to end delay.
I use my awk script to get desire value but I don't know that was not success.
I get this value in my parsing result
send = 8871.00
recv = 0.00
routingpkts = 682.00
PDF = 0.00
NRL = inf
Average e-e delay(ms)= nan
No. of dropped data (packets) = 322
No. of dropped data (bytes)   = 171304

I am attach .tr file in my mail, please help me what's wrong..?
why my recv and PDF = 0.00?
My awk script was wrong? or
can you give me correct calculation with my out2.tr in my attachment ? 
What meaning of :  NRL = inf
              Average e-e delay(ms)= nan
thanks for your reply.
STTTelkom Student at Indonesia


      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
BEGIN {
        sends=0;
        recvs=0;
        routing_packets=0.0;
        droppedBytes=0;
        droppedPackets=0;
        highest_packet_id =0;
        sum=0;
        recvnum=0;
   }

{
        time = $3;
        packet_id = $41;

        #============= CALCULATE PACKET DELIVERY  FRACTION=================
        if (( $1 == "s") &&  ( $35 == "cbr" ) && ( $19=="AGT" ))   {  sends++; }
        if (( $1 == "r") &&  ( $35 == "cbr" ) && ( $19=="AGT" ))   {  recvs++; }

        #============= CALCULATE DELAY     ================================
        if ( start_time[packet_id] == 0 )  start_time[packet_id] = time;
        if (( $1 == "r") &&  ( $35 == "cbr" ) && ( $19=="AGT" )) {  
end_time[packet_id] = time;  }
        else {  end_time[packet_id] = -1;  }

        #============= TOTAL DSR OVERHEAD  ================================
        if (($1 == "s" || $1 == "f") && $19 == "RTR" && $35 =="DSR") 
routing_packets++;

        #============= DROPPED DSR PACKETS ================================
        if (( $1 == "d" ) && ( $35 == "cbr" )  && ( $3 > 0 ))
        {
                droppedBytes=droppedBytes+$37;
                droppedPackets=droppedPackets+1;
        }

        #find the number of packets in the simulation
        if (packet_id > highest_packet_id)
                highest_packet_id = packet_id;
}

END {

for ( i in end_time )
        {
        start = start_time[i];
        end = end_time[i];
        packet_duration = end - start;
        if ( packet_duration > 0 )  { sum += packet_duration; recvnum++; }
        }

   delay=sum/recvnum;
   NRL = routing_packets/recvs;     #normalized routing load = routing load but 
it differ from routing overhead
   PDF = (recvs/sends)*100;         #packet delivery ratio[fraction]
   printf("send = %.2f\n",sends);
   printf("recv = %.2f\n",recvs);
   printf("routingpkts = %.2f\n",routing_packets++);
   printf("PDF = %.2f\n",PDF);
   printf("NRL = %.2f\n",NRL);
   printf("Average e-e delay(ms)= %.2f\n",delay*1000);
   printf("No. of dropped data (packets) = %d\n",droppedPackets);
   printf("No. of dropped data (bytes)   = %d\n",droppedBytes);
   printf("Packet Loss [%]= %.2f  \n", 
(droppedPackets/(highest_packet_id+1))*100);
}

Reply via email to