mirror of
https://github.com/guilhermewerner/tcc
synced 2025-06-25 03:15:25 +00:00
New graphs
This commit is contained in:
44
src/graphs2.py
Normal file
44
src/graphs2.py
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2024 Guilherme Werner
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data_file = "./trace/metrics.csv"
|
||||
metrics_df_all = pd.read_csv(data_file)
|
||||
|
||||
metrics_df_all["protocol"] = metrics_df_all["test"].apply(
|
||||
lambda x: "TCP" if "TCP" in x else "UDP"
|
||||
)
|
||||
|
||||
protocol_colors = {"TCP": "teal", "UDP": "orange"}
|
||||
colors = metrics_df_all["protocol"].map(protocol_colors)
|
||||
|
||||
plt.figure(figsize=(6.4, 4.8))
|
||||
plt.bar(metrics_df_all["test"], metrics_df_all["total_packets"], color=colors)
|
||||
plt.title("Total de Pacotes por Teste")
|
||||
plt.ylabel("Total de Pacotes")
|
||||
plt.xticks(rotation=90)
|
||||
plt.tight_layout()
|
||||
plt.savefig("./trace/total_packets_comparison.png")
|
||||
plt.close()
|
||||
|
||||
plt.figure(figsize=(6.4, 4.8))
|
||||
plt.bar(metrics_df_all["test"], metrics_df_all["average_packet_size_kb"], color=colors)
|
||||
plt.title("Tamanho Médio dos Pacotes por Teste")
|
||||
plt.ylabel("Tamanho Médio dos Pacotes (kB)")
|
||||
plt.xticks(rotation=90)
|
||||
plt.tight_layout()
|
||||
plt.savefig("./trace/average_packet_size_comparison.png")
|
||||
plt.close()
|
||||
|
||||
plt.figure(figsize=(6.4, 4.8))
|
||||
plt.bar(metrics_df_all["test"], metrics_df_all["average_latency_ms"], color=colors)
|
||||
plt.title("Latência Média por Teste")
|
||||
plt.ylabel("Latência Média (ms)")
|
||||
plt.xticks(rotation=90)
|
||||
plt.tight_layout()
|
||||
plt.savefig("./trace/average_latency_comparison.png")
|
||||
plt.close()
|
||||
|
||||
print("Gráficos gerados com sucesso.")
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
13
trace/metrics.csv
Normal file
13
trace/metrics.csv
Normal file
@ -0,0 +1,13 @@
|
||||
test,total_packets,average_packet_size_kb,total_acks,total_syns,average_latency_ms
|
||||
TCP 10,26459,1026.9632261234362,26439,40,2.13
|
||||
TCP 10 L,26064,1062.5262430939226,26044,40,2.26
|
||||
TCP 50,132664,1036.8882967496834,132564,200,0.44
|
||||
TCP 50 L,133821,1058.121991316759,133721,200,0.44
|
||||
TCP 100,280633,1033.3477032280593,280433,400,0.21
|
||||
TCP 100 L,272640,1033.5483384683098,272440,400,0.21
|
||||
UDP 10,9493,385.8986621721268,0,0,6.33
|
||||
UDP 10 L,7212,243.60357737104826,0,0,8.24
|
||||
UDP 50,47746,291.98186235496166,0,0,1.24
|
||||
UDP 50 L,43449,344.595042463578,0,0,1.38
|
||||
UDP 100,95568,350.0265465427758,0,0,0.62
|
||||
UDP 100 L,103938,353.53224037406915,0,0,0.58
|
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Reference in New Issue
Block a user