Thanks a lot, awk script for throughput is working fine but for jitter
it is creating an error
awk: jitter.awk:69: (FILENAME=AODV-RENO-S2-PT0-0.tr FNR=586509) fatal:
division by zero attempted
Actually I have done my simulation of 720 files and it took around two
months with old format it is now not possible to do the simulation of
720 files again since I have shortage of time to submit my work. I hope
you can understand. It is now requested you to please modify the new awk
scripts to old format I'll be obliged to you. I have 3 Routing protocol
DSDV, AODV& DSR I got an awk script but it shows the result so strange
i-e Packet Delivery Ratio for DSR is much much low than DSDV & AODV .
Awk script which I used was
# ===================================================================
# AWK Script for claculating:
# => Send,
# => Received, and
# => Dropped packets, with packets
# => Delivery Ration and Average End-to-End Delay.
# ===================================================================
BEGIN {
seqno = -1;
droppedPackets = 0;
receivedPackets = 0;
count = 0;
}
{
#packet delivery ratio
if($4 == "AGT" && $1 == "s" && seqno < $6) {
seqno = $6;
} else if(($4 == "AGT") && ($1 == "r") && ($7 == "tcp")) {
receivedPackets++;
} else if ($1 == "D" && $7 == "tcp"){
droppedPackets++;
}
#end-to-end delay
if($4 == "AGT" && $1 == "s") {
start_time[$6] = $2;
} else if(($7 == "tcp") && ($1 == "r")) {
end_time[$6] = $2;
} else if($1 == "D" && $7 == "tcp") {
end_time[$6] = -1;
}
}
END {
for(i=0; i<=seqno; i++) {
if(end_time[i] > 0) {
delay[i] = end_time[i] - start_time[i];
count++;
}
else
{
delay[i] = -1;
}
}
for(i=0; i<count; i++) {
if(delay[i] > 0) {
n_to_n_delay = n_to_n_delay + delay[i];
}
}
n_to_n_delay = n_to_n_delay/count;
print "\n";
print "GeneratedPackets = " seqno+1;
print "ReceivedPackets = " receivedPackets;
print "Packet Delivery Ratio = " receivedPackets/(seqno+1)*100
"%";
print "Total Dropped MANET Packets = " droppedPackets;
print "Average End-to-End Delay = " n_to_n_delay * 1000 " ms";
print "\n";
}
Results doesn't show acceptable values :-( please help me in this regard
I'll be grateful to you.
Thanks & Regards
_____
From: Mohammed Abu Hajar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 9:26 PM
To: Sofia Iqbal Khanzada
Cc: NS_2 Mailing List
Subject: RE: [ns] Require Awk script for Old Trace Format File
About the awk script for calculate jitter and the awk script for
calculate throughput is true( notice the first part )
# Trace line format: normal(for old trace)
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
flow_t = $5
level = "AGT"
}
About the awk that calculate Packet Delivery Fraction , Normalize
routing load, End to End delay and drop packets and Routing
Load(overhead) its valid for new trace only. So you can modify the
parameters used in the awk script only or when there ia available time I
will modfy it for you.
Lastly I advice you to use new trace format using TCL command in your
TCL file :
$ns_ use-newtrace
you will get the trace file in new fashion
Mohammed AbuHajar
Sofia Iqbal Khanzada <[EMAIL PROTECTED]> wrote:
Thakyou for earliest prompt. The given script is for new trace
file format and also generating error with new trace file format
FNR=760166) fatal: divi sion by zero attempted
But my trace files are of old format i-e
DSR format
M 0.0 nn 50 x 1000 y 1000 rp DSR
M 0.0 sc
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/NRENO-DSR-Mobility-S2-PT0/
DSDV-NRENO-S2-PT0-0 cp
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/TCP-NewReno-TrafficFile
seed 1.0
M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna
Sconfig 0.00000 tap: on snoop: rts? on errs? on
Sconfig 0.00000 salvage: on !bd replies? on
Sconfig 0.00000 grat error: on grat reply: on
Sconfig 0.00000 $reply for props: on ring 0 search: on
Sconfig 0.00000 using MOBICACHE
M 0.00000 0 (313.64, 43.50, 0.00), (442.09, 926.57), 2.00
M 0.00000 1 (970.07, 601.01, 0.00), (720.90, 277.89), 2.00
M 0.00000 2 (354.37, 386.19, 0.00), (997.43, 797.71), 2.00
M 0.00000 3 (161.48, 218.16, 0.00), (447.07, 813.34), 2.00
M 0.00000 4 (988.06, 330.81, 0.00), (727.83, 911.39), 2.00
M 0.00000 5 (339.30, 958.75, 0.00), (149.38, 412.51), 2.00
M 0.00000 6 (253.38, 61.00, 0.00), (715.89, 31.36), 2.00
M 0.00000 7 (86.21, 619.90, 0.00), (734.28, 690.18), 2.00
M 0.00000 8 (822.74, 970.59, 0.00), (289.19, 505.51), 2.00
s 2.556838879 _1_ AGT --- 0 tcp 40 [0 0 0 0] ------- [1:0 2:0
32 0] [0 0] 0 4
r 2.556838879 _1_ RTR --- 0 tcp 40 [0 0 0 0] ------- [1:0 2:0
32 0] [0 0] 0 4
s 2.557152010 _1_ RTR --- 1 DSR 32 [0 0 0 0] ------- [1:255
2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964124 _28_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964384 _22_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964432 _34_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964491 _15_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964595 _25_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964635 _11_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255 32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
I need script for these files :-( I have spent around 2 months
for simulating 720 files :-(
I 'll be grateful to you for ur kind support.
Thanks & Regards,
_____
From: Mohammed Abu Hajar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 12:38 PM
To: Sofia Iqbal Khanzada
Cc: NS_2 Mailing List
Subject: Re: [ns] Require Awk script for Old Trace Format File
Tools and Scripts for Getting Results
AWK script to measure send, receive, routing and drop packets. Packet
delivery ratio, routing overhead, normalize routing load, average end to
end delay.
parameters.awk
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; }
# CALCULATE 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
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);
}
AWK script for calculate the throughput
Throughput.awk
BEGIN {
recvdSize = 0
startTime = 1e6
stopTime = 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
flow_t = $5
level = "AGT"
}
# Trace line format: new
if ($2 == "-t") {
event = $1
time = $3
node_id = $5
flow_id = $39
pkt_id = $41
pkt_size = $37
flow_t = $45
level = $19
}
# Store start time
if (level == "AGT" && (event == "+" || event == "s") && pkt_size
>= 512) {
if (time < startTime) {
startTime = time
}
}
# Update total received packets' size and store packets arrival
time
if (level == "AGT" && event == "r" && pkt_size >= 512) {
if (time > stopTime) {
stopTime = time
}
# Rip off the header
hdr_size = pkt_size % 512
pkt_size -= hdr_size
# Store received packet's size
recvdSize += pkt_size
}
}
END {
printf("Average Throughput[kbps] = %.2f\t\t
StartTime=%.2f\tStopTime=%.2f\n",(recvdSize/(stopTime-startTime))*(8/100
0),startTime,stopTime)
}
AWK script for compute delay jitter
Jitter.awk
BEGIN {
num_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
flow_t = $5
level = "AGT"
}
# Trace line format: new
if ($2 == "-t") {
event = $1
time = $3
node_id = $5
flow_id = $39
pkt_id = $41
pkt_size = $37
flow_t = $45
level = $19
}
# Store packets send time
if (level == "AGT" && sendTime[pkt_id] == 0 && (event == "+" ||
event == "s") && pkt_size >= 512) {
sendTime[pkt_id] = time
}
# Store packets arrival time
if (level == "AGT" && event == "r" && pkt_size >= 512) {
recvTime[pkt_id] = time
num_recv++
}
}
END {
# Compute average jitter
jitter1 = jitter2 = tmp_recv = 0
prev_time = delay = prev_delay = processed = 0
prev_delay = -1
for (i=0; processed<num_recv; i++) {
if(recvTime[i] != 0) {
tmp_recv++
if(prev_time != 0) {
delay = recvTime[i] - prev_time
e2eDelay = recvTime[i] - sendTime[i]
if(delay < 0) delay = 0
if(prev_delay != -1) {
jitter1 += abs(e2eDelay - prev_e2eDelay)
jitter2 += abs(delay-prev_delay)
}
prev_delay = delay
prev_e2eDelay = e2eDelay
}
prev_time = recvTime[i]
}
processed++
}
}
END {
printf("Jitter1 = %.2f\n",jitter1*1000/tmp_recv);
printf("Jitter2 = %.2f\n",jitter2*1000/tmp_recv);
}
function abs(value) {
if (value < 0) value = 0-value
return value
}
Mohammed AbuHajar
ns user <[EMAIL PROTECTED]> wrote:
hi,
I have simulated AODV, DSDV and DSR with TCP variants Reno,
NewReno and
Vegas. now i have trace file with the following format (DSDV
format) the
format is old
M 0.0 nn 50 x 1000 y 1000 rp DSDV
M 0.0 sc
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/DSDV-Mobilit-S2-PT0/DSDV-R
ENO-S2-PT0-0
cp
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/TCP-Reno-TrafficFile seed
1.0 M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna
M 0.00000 0
(108.79, 121.80, 0.00), (477.54, 277.38), 2.00 M 0.00000 1
(661.65, 886.95,
0.00), (610.30, 510.36), 2.00 M 0.00000 2 (441.88, 557.58,
0.00), (35.61,
684.55), 2.00 M 0.00000 3 (681.72, 645.08, 0.00), (891.98,
394.46), 2.00 M
0.00000 4 (550.56, 836.00, 0.00), (570.78, 98.00), 2.00 r
50.783030204 _41_
RTR --- 5168 ack 60 [13a 29 9 800] ------- [9:0 7:2 32 41] [66
0] 1 2 f
50.783030204 _41_ RTR --- 5168 ack 60 [13a 29 9 800] -------
[9:0 7:2 31 7]
[66 0] 1 2 r 50.785107893 _7_ AGT --- 5423 ack 60 [13a 7 8 800]
-------
[8:0 7:1 32 7] [547 0] 1 1 s 50.785107893 _7_ AGT --- 5463 tcp
1064 [0 0 0
0] ------- [7:1 8:0 32 0] [562 0] 0 1 r 50.785107893 _7_ RTR ---
5463 tcp
1064 [0 0 0 0] ------- [7:1 8:0 32 0] [562 0] 0 1 s 50.785107893
_7_ RTR
--- 5463 tcp 1084 [0 0 0 0] ------- [7:1 8:0 32 8] [562 0] 0 1 r
50.795417368 _8_ AGT --- 5438 tcp 1084 [13a 8 7 800] -------
[7:1 8:0 32 8]
[557 0] 1 1 s 50.795417368 _8_ AGT --- 5464 ack 40 [0 0 0 0]
------- [8:0
7:1 32 0] [557 0] 0 1 r 50.795417368 _8_ RTR --- 5464 ack 40 [0
0 0 0]
------- [8:0 7:1 32 0] [557 0] 0 1 s 50.795417368 _8_ RTR ---
5464 ack 60
[0 0 0 0] ------- [8:0 7:1 32 7] [557 0] 0 1 r 50.805667684 _9_
AGT ---
5428 tcp 1084 [13a 9 8 800] ------- [8:1 9:1 32 9] [963 0] 1 1 s
50.805667684 _9_ AGT --- 5465 ack 40 [0 0 0 0] ------- [9:1 8:1
32 0] [963
0] 0 1 r 50.805667684 _9_ RTR --- 5465 ack 40 [0 0 0 0] -------
[9:1 8:1 32
0] [963 0] 0 1 s 50.805667684 _9_ RTR --- 5465 ack 60 [0 0 0 0]
-------
[9:1 8:1 32 8] [963 0] 0 1 r 50.807705921 _41_ RTR --- 5179 ack
60 [13a 29
9 800] ------- [9:0 7:2 32 41] [67 0] 1 2 f 50.807705921 _41_
RTR --- 5179
ack 60 [13a 29 9 800] ------- [9:0 7:2 31 7] [67 0] 1 2
DSR format
M 0.0 nn 50 x 1000 y 1000 rp DSR
M 0.0 sc
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/NRENO-DSR-Mobility-S2-PT0/
DSDV-NRENO-S2-PT0-0
cp
~/ns-allinone-2.30/ns-2.30/tcl/mobility/scene/TCP-NewReno-TrafficFile
seed 1.0
M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna
Sconfig 0.00000 tap: on snoop: rts? on errs? on
Sconfig 0.00000 salvage: on !bd replies? on
Sconfig 0.00000 grat error: on grat reply: on
Sconfig 0.00000 $reply for props: on ring 0 search: on
Sconfig 0.00000 using MOBICACHE
M 0.00000 0 (313.64, 43.50, 0.00), (442.09, 926.57), 2.00
M 0.00000 1 (970.07, 601.01, 0.00), (720.90, 277.89), 2.00
M 0.00000 2 (354.37, 386.19, 0.00), (997.43, 797.71), 2.00
M 0.00000 3 (161.48, 218.16, 0.00), (447.07, 813.34), 2.00
M 0.00000 4 (988.06, 330.81, 0.00), (727.83, 911.39), 2.00
M 0.00000 5 (339.30, 958.75, 0.00), (149.38, 412.51), 2.00
M 0.00000 6 (253.38, 61.00, 0.00), (715.89, 31.36), 2.00
M 0.00000 7 (86.21, 619.90, 0.00), (734.28, 690.18), 2.00
M 0.00000 8 (822.74, 970.59, 0.00), (289.19, 505.51), 2.00
s 2.556838879 _1_ AGT --- 0 tcp 40 [0 0 0 0] ------- [1:0 2:0 32
0] [0 0] 0
4
r 2.556838879 _1_ RTR --- 0 tcp 40 [0 0 0 0] ------- [1:0 2:0 32
0] [0 0] 0
4
s 2.557152010 _1_ RTR --- 1 DSR 32 [0 0 0 0] ------- [1:255
2:255 32 0] 1
[1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964124 _28_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964384 _22_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964432 _34_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964491 _15_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964595 _25_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
r 2.557964635 _11_ RTR --- 1 DSR 32 [0 ffffffff 1 800] -------
[1:255 2:255
32 0] 1 [1 1] [0 1 0 0->0] [0 0 0 0->0]
now i need an awk script to calculate TCP parameters throughput
, paket
delivery ratio ... etc
Please help me in this regard i'll be thankful to you
--
View this message in context:
http://www.nabble.com/Require-Awk-script-for-Old-Trace-Format-File-tf419
8129.html#a11939926
Sent from the ns-users mailing list archive at Nabble.com.
_____
Got a little couch potato?
Check out fun summer activities for kids.
<http://us.rd.yahoo.com/evt=48248/*http:/search.yahoo.com/search?fr=oni_
on_mail&p=summer+activities+for+kids&cs=bz>
_____
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.
<http://us.rd.yahoo.com/evt=48246/*http:/autos.yahoo.com/green_center/;_
ylc=X3oDMTE5cDF2bXZzBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDZ3JlZW4tY2Vu
dGVy>