Skip to content

Commit

Permalink
✨ match it to the new format
Browse files Browse the repository at this point in the history
  • Loading branch information
YousefEZ committed Apr 6, 2024
1 parent e976be9 commit a2466b3
Show file tree
Hide file tree
Showing 16 changed files with 441 additions and 408 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/bandwidth_alternate-baseline_udp-frr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/bandwidth_primary-baseline_udp-frr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/delay_all-baseline_no_udp-frr_no_udp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/delay_all-baseline_udp-frr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/delay_alternate-baseline_udp-frr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pcap_analysis/plots/delay_primary-baseline_udp-frr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 41 additions & 40 deletions pcap_analysis/process_pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,28 @@ def flow_completion_time(packets):


# def save_plot(timestamp, completion_time, stream_direction):
# os.makedirs("/host/pcap_analysis/plots", exist_ok=True)
# os.makedirs("../pcap_analysis/plots", exist_ok=True)
# plt.plot(timestamp, completion_time, label=stream_direction, marker='o')
# plt.xlabel("time stamp of the sender of the packet")
# plt.ylabel("transfer completion time")
#
# plt.savefig("/host/pcap_analysis/plots/completion_time-timestamp.png")
# plt.savefig("../pcap_analysis/plots/completion_time-timestamp.png")

def get_avg_fc_time(source_directory):

seeds = os.listdir(source_directory)
fc_time = 0.0
for seed in seeds:
sd = f"{source_directory}/{seed}/-TrafficSender0-1.pcap"
result = flow_completion_time(read_pcap(sd))
assert result is not None, "Unable to read from directory"
fc_time += result
print(source_directory, fc_time / len(seeds))
return fc_time / len(seeds)

def record_result(source_directory, variable, queue_size, scenario, results):
fc_time = get_avg_fc_time(f"{source_directory}{variable}/{queue_size}/{scenario}")
results.append((scenario.replace("-", "_"), queue_size, fc_time, variable))


def record_flow_completion_time(source_directory, result_directory, mode):
Expand All @@ -76,25 +92,10 @@ def record_flow_completion_time(source_directory, result_directory, mode):
queue_sizes = os.listdir(source_directory + variable)
for queue_size in queue_sizes:
if os.path.isdir(os.path.join(source_directory + variable + "/" + queue_size)) and queue_size != '99':
senderPackets = read_pcap(
source_directory + variable + "/" + queue_size + "/" + "baseline-no-udp/-TrafficSender-1.pcap")
fc_time = flow_completion_time(senderPackets)
results.append(("baseline_no_udp", queue_size, fc_time, variable))

senderPackets = read_pcap(
source_directory + variable + "/" + queue_size + "/" + "baseline-udp/-TrafficSender-1.pcap")
fc_time = flow_completion_time(senderPackets)
results.append(("baseline_udp", queue_size, fc_time, variable))

senderPackets = read_pcap(
source_directory + variable + "/" + queue_size + "/" + "frr-no-udp/-TrafficSender-1.pcap")
fc_time = flow_completion_time(senderPackets)
results.append(("frr_no_udp", queue_size, fc_time, variable))

senderPackets = read_pcap(
source_directory + variable + "/" + queue_size + "/" + "frr/-TrafficSender-1.pcap")
fc_time = flow_completion_time(senderPackets)
results.append(("frr", queue_size, fc_time, variable))
record_result(source_directory, variable, queue_size, "baseline-no-udp", results)
record_result(source_directory, variable, queue_size, "baseline-udp", results)
record_result(source_directory, variable, queue_size, "frr-no-udp", results)
record_result(source_directory, variable, queue_size, "frr", results)

filepath = os.path.join(result_directory, f"{mode}.txt")
with open(filepath, 'w') as f:
Expand Down Expand Up @@ -175,37 +176,37 @@ def plot_flow_completion_time(results, mode, cases):
figure.subplots_adjust(left=0.2)
# figure.tight_layout()

figure.savefig(f"/host/pcap_analysis/plots/{mode}-{cases[0]}-{cases[1]}.png", dpi=300)
figure.savefig(f"../pcap_analysis/plots/{mode}-{cases[0]}-{cases[1]}.png", dpi=300)


if __name__ == '__main__':
os.makedirs("/host/pcap_analysis/results", exist_ok=True)
os.makedirs("/host/pcap_analysis/plots", exist_ok=True)
os.makedirs("../pcap_analysis/results", exist_ok=True)
os.makedirs("../pcap_analysis/plots", exist_ok=True)

bandwidth_primary_results = record_flow_completion_time("/host/experiments/bandwidth-primary/",
"/host/pcap_analysis/results", "bandwidth_primary")
bandwidth_primary_results = record_flow_completion_time("../traces/bandwidth_primary/",
"../pcap_analysis/results", "bandwidth_primary")
plot_flow_completion_time(bandwidth_primary_results, "bandwidth_primary", ['baseline_no_udp', 'frr_no_udp'])
# no udp
plot_flow_completion_time(bandwidth_primary_results, "bandwidth_primary", ['baseline_udp', 'frr'])
# with udp

bandwidth_alternate_results = record_flow_completion_time("/host/experiments/bandwidth-alternate/",
"/host/pcap_analysis/results", "bandwidth_alternate")
plot_flow_completion_time(bandwidth_alternate_results, "bandwidth_alternate", ['baseline_no_udp', 'frr_no_udp'])
plot_flow_completion_time(bandwidth_alternate_results, "bandwidth_alternate", ['baseline_udp', 'frr'])
#bandwidth_alternate_results = record_flow_completion_time("../traces/bandwidth_alternate/",
# "../pcap_analysis/results", "bandwidth_alternate")
#plot_flow_completion_time(bandwidth_alternate_results, "bandwidth_alternate", ['baseline_no_udp', 'frr_no_udp'])
#plot_flow_completion_time(bandwidth_alternate_results, "bandwidth_alternate", ['baseline_udp', 'frr'])

delay_all_results = record_flow_completion_time("/host/experiments/delay-all/",
"/host/pcap_analysis/results", "delay_all")
plot_flow_completion_time(delay_all_results, "delay_all", ['baseline_no_udp', 'frr_no_udp'])
plot_flow_completion_time(delay_all_results, "delay_all", ['baseline_udp', 'frr'])
#delay_all_results = record_flow_completion_time("../traces/delay_all/",
# "../pcap_analysis/results", "delay_all")
#plot_flow_completion_time(delay_all_results, "delay_all", ['baseline_no_udp', 'frr_no_udp'])
#plot_flow_completion_time(delay_all_results, "delay_all", ['baseline_udp', 'frr'])

delay_primary_results = record_flow_completion_time("/host/experiments/delay-primary/",
"/host/pcap_analysis/results", "delay_primary")
delay_primary_results = record_flow_completion_time("../traces/delay_primary/",
"../pcap_analysis/results", "delay_primary")
plot_flow_completion_time(delay_primary_results, "delay_primary", ['baseline_no_udp', 'frr_no_udp'])
plot_flow_completion_time(delay_primary_results, "delay_primary", ['baseline_udp', 'frr'])

delay_alternate_results = record_flow_completion_time("/host/experiments/delay-alternate/",
"/host/pcap_analysis/results", "delay_alternate")
delay_alternate_results = record_flow_completion_time("../traces/delay_alternate/",
"../pcap_analysis/results", "delay_alternate")
plot_flow_completion_time(delay_alternate_results, "delay_alternate", ['baseline_no_udp', 'frr_no_udp'])
plot_flow_completion_time(delay_alternate_results, "delay_alternate", ['baseline_udp', 'frr'])

Expand All @@ -224,8 +225,8 @@ def plot_flow_completion_time(results, mode, cases):
# results.append(result)
# # save_plot(timestamp, completion_time, stream_direction)
#
# os.makedirs("/host/pcap_analysis/results", exist_ok=True)
# os.makedirs("../pcap_analysis/results", exist_ok=True)
#
# with open("/host/pcap_analysis/results/results.txt", "w") as f:
# with open("../pcap_analysis/results/results.txt", "w") as f:
# for result in results:
# f.write(result)
80 changes: 0 additions & 80 deletions pcap_analysis/results/bandwidth_alternate.txt
Original file line number Diff line number Diff line change
@@ -1,80 +0,0 @@
('baseline_no_udp', '60', Decimal('6.390986'), '800Kbps')
('baseline_udp', '60', Decimal('8.900453'), '800Kbps')
('frr_no_udp', '60', Decimal('3.233893'), '800Kbps')
('frr', '60', Decimal('3.636093'), '800Kbps')
('baseline_no_udp', '20', Decimal('6.390986'), '800Kbps')
('baseline_udp', '20', Decimal('8.900453'), '800Kbps')
('frr_no_udp', '20', Decimal('2.946426'), '800Kbps')
('frr', '20', Decimal('3.501319'), '800Kbps')
('baseline_no_udp', '80', Decimal('6.390986'), '800Kbps')
('baseline_udp', '80', Decimal('8.900453'), '800Kbps')
('frr_no_udp', '80', Decimal('3.262639'), '800Kbps')
('frr', '80', Decimal('4.251466'), '800Kbps')
('baseline_no_udp', '40', Decimal('6.390986'), '800Kbps')
('baseline_udp', '40', Decimal('8.900453'), '800Kbps')
('frr_no_udp', '40', Decimal('3.018293'), '800Kbps')
('frr', '40', Decimal('3.306693'), '800Kbps')
('baseline_no_udp', '60', Decimal('6.390986'), '1000Kbps')
('baseline_udp', '60', Decimal('8.900453'), '1000Kbps')
('frr_no_udp', '60', Decimal('3.047039'), '1000Kbps')
('frr', '60', Decimal('4.745221'), '1000Kbps')
('baseline_no_udp', '20', Decimal('6.390986'), '1000Kbps')
('baseline_udp', '20', Decimal('8.900453'), '1000Kbps')
('frr_no_udp', '20', Decimal('2.817066'), '1000Kbps')
('frr', '20', Decimal('5.015125'), '1000Kbps')
('baseline_no_udp', '80', Decimal('6.390986'), '1000Kbps')
('baseline_udp', '80', Decimal('8.900453'), '1000Kbps')
('frr_no_udp', '80', Decimal('3.104533'), '1000Kbps')
('frr', '80', Decimal('5.043573'), '1000Kbps')
('baseline_no_udp', '40', Decimal('6.390986'), '1000Kbps')
('baseline_udp', '40', Decimal('8.900453'), '1000Kbps')
('frr_no_udp', '40', Decimal('2.903306'), '1000Kbps')
('frr', '40', Decimal('4.245994'), '1000Kbps')
('baseline_no_udp', '60', Decimal('6.390986'), '200Kbps')
('baseline_udp', '60', Decimal('8.900453'), '200Kbps')
('frr_no_udp', '60', Decimal('3.751333'), '200Kbps')
('frr', '60', Decimal('6.023146'), '200Kbps')
('baseline_no_udp', '20', Decimal('6.390986'), '200Kbps')
('baseline_udp', '20', Decimal('8.900453'), '200Kbps')
('frr_no_udp', '20', Decimal('3.666266'), '200Kbps')
('frr', '20', Decimal('5.896239'), '200Kbps')
('baseline_no_udp', '80', Decimal('6.390986'), '200Kbps')
('baseline_udp', '80', Decimal('8.900453'), '200Kbps')
('frr_no_udp', '80', Decimal('3.780079'), '200Kbps')
('frr', '80', Decimal('6.534879'), '200Kbps')
('baseline_no_udp', '40', Decimal('6.390986'), '200Kbps')
('baseline_udp', '40', Decimal('8.900453'), '200Kbps')
('frr_no_udp', '40', Decimal('6.108559'), '200Kbps')
('frr', '40', Decimal('7.952719'), '200Kbps')
('baseline_no_udp', '60', Decimal('6.390986'), '600Kbps')
('baseline_udp', '60', Decimal('8.900453'), '600Kbps')
('frr_no_udp', '60', Decimal('3.236239'), '600Kbps')
('frr', '60', Decimal('5.426933'), '600Kbps')
('baseline_no_udp', '20', Decimal('6.390986'), '600Kbps')
('baseline_udp', '20', Decimal('8.900453'), '600Kbps')
('frr_no_udp', '20', Decimal('2.948773'), '600Kbps')
('frr', '20', Decimal('3.091626'), '600Kbps')
('baseline_no_udp', '80', Decimal('6.390986'), '600Kbps')
('baseline_udp', '80', Decimal('8.900453'), '600Kbps')
('frr_no_udp', '80', Decimal('3.263813'), '600Kbps')
('frr', '80', Decimal('4.438213'), '600Kbps')
('baseline_no_udp', '40', Decimal('6.390986'), '600Kbps')
('baseline_udp', '40', Decimal('8.900453'), '600Kbps')
('frr_no_udp', '40', Decimal('3.022399'), '600Kbps')
('frr', '40', Decimal('4.931786'), '600Kbps')
('baseline_no_udp', '60', Decimal('6.390986'), '400Kbps')
('baseline_udp', '60', Decimal('8.900453'), '400Kbps')
('frr_no_udp', '60', Decimal('2.882919'), '400Kbps')
('frr', '60', Decimal('4.140639'), '400Kbps')
('baseline_no_udp', '20', Decimal('6.390986'), '400Kbps')
('baseline_udp', '20', Decimal('8.900453'), '400Kbps')
('frr_no_udp', '20', Decimal('3.076373'), '400Kbps')
('frr', '20', Decimal('4.464826'), '400Kbps')
('baseline_no_udp', '80', Decimal('6.390986'), '400Kbps')
('baseline_udp', '80', Decimal('8.900453'), '400Kbps')
('frr_no_udp', '80', Decimal('2.963146'), '400Kbps')
('frr', '80', Decimal('4.420373'), '400Kbps')
('baseline_no_udp', '40', Decimal('6.390986'), '400Kbps')
('baseline_udp', '40', Decimal('8.900453'), '400Kbps')
('frr_no_udp', '40', Decimal('3.075786'), '400Kbps')
('frr', '40', Decimal('5.853919'), '400Kbps')
Loading

0 comments on commit a2466b3

Please sign in to comment.