Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Modify multicast awk file
Browse files Browse the repository at this point in the history
  • Loading branch information
kbdharun committed Sep 5, 2023
1 parent 127ffa0 commit db7e7ce
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 15 deletions.
Binary file added Multicast-Routing/Output3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions Multicast-Routing/analysis-old.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Initialize variables
BEGIN {
group0_sent_packets = 0
group1_sent_packets = 0
group0_received_packets = 0
group1_received_packets = 0
start_time = -1
end_time = -1
}

# Process each line in the trace file
{
if ($1 == "+" && $5 == "cbr" && $6 == "210") {
event_time = $2
if (start_time < 0 || event_time < start_time) {
start_time = event_time
}
end_time = event_time
agent_id = $4
if (agent_id == "0") {
group0_sent_packets++
} else if (agent_id == "1") {
group1_sent_packets++
}
} else if ($1 == "-" && $5 == "cbr" && $6 == "210") {
event_time = $2
agent_id = $4
if (agent_id == "0") {
group0_received_packets++
} else if (agent_id == "1") {
group1_received_packets++
}
}
}

# Calculate and print multicast throughput for each group
END {
if (start_time < 0 || end_time < 0) {
print "No valid data found in the trace file."
exit 1
}

duration = end_time - start_time
group0_throughput = (group0_received_packets / duration)
group1_throughput = (group1_received_packets / duration)

printf("Group 0 Throughput: %.2f packets/sec\n", group0_throughput)
printf("Group 1 Throughput: %.2f packets/sec\n", group1_throughput)
}
32 changes: 17 additions & 15 deletions Multicast-Routing/analysis.awk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Initialize variables
BEGIN {
group0_sent_packets = 0
group1_sent_packets = 0
group0_received_packets = 0
group1_received_packets = 0
group0_sent_bits = 0
group1_sent_bits = 0
group0_received_bits = 0
group1_received_bits = 0
start_time = -1
end_time = -1
}
Expand All @@ -16,35 +16,37 @@ BEGIN {
start_time = event_time
}
end_time = event_time
agent_id = $4
agent_id = $3
packet_size_bits = $10 # Assuming packet size is reported in bits
if (agent_id == "0") {
group0_sent_packets++
group0_sent_bits += packet_size_bits
} else if (agent_id == "1") {
group1_sent_packets++
group1_sent_bits += packet_size_bits
}
} else if ($1 == "-" && $5 == "cbr" && $6 == "210") {
event_time = $2
agent_id = $4
agent_id = $3
packet_size_bits = $10 # Assuming packet size is reported in bits
if (agent_id == "0") {
group0_received_packets++
group0_received_bits += packet_size_bits
} else if (agent_id == "1") {
group1_received_packets++
group1_received_bits += packet_size_bits
}
}
}

# Calculate and print multicast throughput for each group
# Calculate and print multicast throughput for each group in kbps
END {
if (start_time < 0 || end_time < 0) {
print "No valid data found in the trace file."
exit 1
}

duration = end_time - start_time
group0_throughput = (group0_received_packets / duration)
group1_throughput = (group1_received_packets / duration)
group0_throughput = (group0_received_bits / duration) / 1000 # Convert to kbps
group1_throughput = (group1_received_bits / duration) / 1000

printf("Group 0 Throughput: %.2f packets/sec\n", group0_throughput)
printf("Group 1 Throughput: %.2f packets/sec\n", group1_throughput)
printf("Group 0 Average Throughput: %.2f kbps\n", group0_throughput)
printf("Group 1 Average Throughput: %.2f kbps\n", group1_throughput)
}

0 comments on commit db7e7ce

Please sign in to comment.