From 1ba21da6cbc63c0c549fb92731e25bedc482eb51 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Thu, 4 Sep 2025 22:25:39 +0200 Subject: Unify the directory, add new analysis methods, unify the code style Signed-off-by: Filip Wandzio --- analysis/e1anl/src/analyze.py | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 analysis/e1anl/src/analyze.py (limited to 'analysis/e1anl/src/analyze.py') diff --git a/analysis/e1anl/src/analyze.py b/analysis/e1anl/src/analyze.py new file mode 100644 index 0000000..6e73df3 --- /dev/null +++ b/analysis/e1anl/src/analyze.py @@ -0,0 +1,49 @@ +# analyze_metrics.py + +import pandas as pd +import matplotlib.pyplot as plt +import seaborn as sns + +import os +os.makedirs("output", exist_ok=True) + +def analyze(): + CSV_FILE = "output/rtt_throughput_log.csv" + df = pd.read_csv(CSV_FILE) + + df['sent_ms'] = df['sent_ms'].astype(int) + df['received_ms'] = df['received_ms'].astype(int) + df['rtt_ms'] = df['rtt_ms'].astype(int) + df['throughput_msg_per_s'] = df['throughput_msg_per_s'].astype(float) + + mean_rtt = df['rtt_ms'].mean() + p95_rtt = df['rtt_ms'].quantile(0.95) + mean_throughput = df['throughput_msg_per_s'].mean() + + print(f"Średnie RTT: {mean_rtt:.2f} ms") + print(f"RTT 95-percentyl: {p95_rtt:.2f} ms") + print(f"Średni throughput: {mean_throughput:.2f} msg/s") + + plt.figure(figsize=(6,4)) + sns.barplot(x=['Variant A'], y=[mean_rtt], palette="Set2") + plt.title("Średnie RTT - wariant A") + plt.ylabel("RTT [ms]") + plt.tight_layout() + plt.savefig("output/rtt_mean_a.png") + plt.show() + + plt.figure(figsize=(6,4)) + sns.barplot(x=['Variant A'], y=[p95_rtt], palette="Set3") + plt.title("RTT 95-percentyl - wariant A") + plt.ylabel("RTT [ms]") + plt.tight_layout() + plt.savefig("output/rtt_p95_a.png") + plt.show() + + plt.figure(figsize=(6,4)) + sns.barplot(x=['Variant A'], y=[mean_throughput], palette="Set1") + plt.title("Średni throughput - wariant A") + plt.ylabel("Messages per second") + plt.tight_layout() + plt.savefig("output/throughput_a.png") + plt.show() -- cgit v1.2.3