Ibrahim,
download the latest version from http://reti.polito.it/fiore and follow the read.me for instructions on how to run the scripts. bye, Marco >----Messaggio originale---- >Da: [EMAIL PROTECTED] com >Data: 22-mar-2007 10.19 AM >A: <ns-users@ISI.EDU> >Ogg: [ns] problem in delay and throughput script > > >Hi all, > I have worked for TRACE format .I have used delay.awk,throughput.awk for my tcl progrm >It runs successfully for delay but not for thrpughput. >for throughput error : > awk: thrput.awk:44: (FILENAME=hybrid.tr FNR=122048) fatal: division by zero attempted > while executing > awk -f thrput.awk hybrid.tr > result.tr > >for delay > it runs successfully.But the problem is that the new file generated (.tr) is empty.The new file has not any data. > > # throughput.awk > BEGIN { > recv = 0 > } > { > # Trace line format: normal > if ($2 != "-t") { > event = $1 > time = $2 > if (event == "+" || event == "-") node_id = $3 > if (event == "r" || event == "d") node_id = $4 > flow_id = $8 > pkt_id = $12 > pkt_size = $6 > } > # Trace line format: new > if ($2 == "-t") { > event = $1 > time = $3 > node_id = $5 > flow_id = $39 > pkt_id = $41 > pkt_size = $37 > } > # Calculate total received packets' size > if (flow_id == flow && event == "r" && node_id == dst) { > if (flow_t != "sctp") { > recv += pkt_size - hdr_size > #printf("recv[%g] = %g %g\n",node_id,pkt_size > -hdr_size,recv) > } else { > # Rip off SCTP header, whose size depends > # on the number of chunks in each packet > if (pkt_size != 448 && pkt_size != 864 && > pkt_size != 1280) pkt_size = 0 > if (pkt_size == 448) pkt_size = 400 > if (pkt_size == 864) pkt_size = 800 > if (pkt_size == 1280) pkt_size = 1200 > recv += pkt_size > #printf("recv[%g] = %g --> tot: % > g\n",node_id,pkt_size,recv) > } > } > } > END { > printf("%10g %10s %10g\n",flow,flow_t,(recv/simtime)*(8/1000)) > } > > #Delay.awk >BEGIN { > for (i in send) { > send[i] = 0 > } > for (i in recv) { > recv[i] = 0 > } > delay = avg_delay = 0 > } > { > # Trace line format: normal > if ($2 != "-t") { > event = $1 > time = $2 > if (event == "+" || event == "-") node_id = $3 > if (event == "r" || event == "d") node_id = $4 > flow_id = $8 > pkt_id = $12 > } > # Trace line format: new > if ($2 == "-t") { > event = $1 > time = $3 > node_id = $5 > flow_id = $39 > pkt_id = $41 > } > # Store packets send time > if (flow_id == flow && node_id == src && send [pkt_id] == 0 && (event == "+" || event > =="s")) { > send[pkt_id] = time > } > # Store packets arrival time > if (flow_id == flow && node_id == dst && event == "r") { > recv[pkt_id] = time > } > } > END { > # Compute average delay > for (i in recv) { > if (send[i] == 0) { > printf ("\nError %g\n",i) > } > delay += recv [i] - send[i] > num ++ > } > printf("% 10g ",flow) > if (num != 0) { > avg_delay = delay / num > } else { > avg_delay = 0 > } > printf("%10g\n",avg_delay*1000) >} > > thanks > > ibrahim > > >--------------------------------- >Don't be flakey. Get Yahoo! Mail for Mobile and >always stay connected to friends. >