[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] End-to-end delay in wireless



"Mattos, Leonardo" wrote:
> 
> Hi all,
> 
> Does anyone have a script to post process the CMU trace files in order to
> obtain ete delay?
> I have done packet delivery fraction, throughput, routing load etc...but I
> am not sure my results for ete delay are good.
> 
> Thanks in advance!
> Leo

If using new trace, you can use my script - it will give to layer-to-layer
delay for each pkt indexed by the start time for the packet at that layer.
The layer could be AGT for end to end delay.

The script uses a bunch of std unix utils; so..

:a
#!/bin/tcsh
#
# works on a trace file produced by ns
# outputs layer-to-layer per-packet latency for a given flow,
# indexed by the send time for the packet

if ( $#argv != 3 ) then
  echo usage:
  echo "      " $0 \<trace file\> \<flow id\> \<layer\>
  exit 1
endif

set tracefile = $1
set flow = $2
set layer = $3

set tmpfile = `mktemp /tmp/latency.sendtimes.XXXXXX`

# determine the first packet generated for a flow
set pkt = `grep ^s $tracefile | grep "\-Nl $layer " | grep "\-If $flow " | head -n 1 | awk '{print $43;}'`

# determine the sender/receiver based on the first packet exchanged
set snode = `grep ^s $tracefile | grep "\-Nl $layer " | grep "\-If $flow " | grep "\-Ii $pkt " | head -n 1 | awk '{print $9;}'`
set rnode = `grep ^r $tracefile | grep "\-Nl $layer " | grep "\-If $flow " | grep "\-Ii $pkt " | tail -n 1 | awk '{print $9;}'`

# determine per-packet send times; use the first transmission
# time if there are retransmissions
grep ^s $tracefile | grep "\-Nl $layer " | grep "\-If $flow " | grep "\-Ni $snode " | awk '{ print $43, $3;}' | sort -k1,1g -u >> $tmpfile

# determine per-packet recv times, match them to send times
# based on the packet id, and compute latency; use the time
# of the first recv if there were retransmissions
grep ^r $tracefile | grep "\-Nl $layer " | grep "\-If $flow " | grep "\-Ni $rnode " | awk '{ print $43, $3;}' | sort -k1,1g -u | join $tmpfile - | awk '{ printf "%.9f %.9f\n", $2, ($3 - $2);}'

# cleanup
rm $tmpfile