diff options
Diffstat (limited to 'analysis/e1anl/src/analyze.py')
| -rw-r--r-- | analysis/e1anl/src/analyze.py | 49 |
1 files changed, 49 insertions, 0 deletions
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 @@ | |||
| 1 | # analyze_metrics.py | ||
| 2 | |||
| 3 | import pandas as pd | ||
| 4 | import matplotlib.pyplot as plt | ||
| 5 | import seaborn as sns | ||
| 6 | |||
| 7 | import os | ||
| 8 | os.makedirs("output", exist_ok=True) | ||
| 9 | |||
| 10 | def analyze(): | ||
| 11 | CSV_FILE = "output/rtt_throughput_log.csv" | ||
| 12 | df = pd.read_csv(CSV_FILE) | ||
| 13 | |||
| 14 | df['sent_ms'] = df['sent_ms'].astype(int) | ||
| 15 | df['received_ms'] = df['received_ms'].astype(int) | ||
| 16 | df['rtt_ms'] = df['rtt_ms'].astype(int) | ||
| 17 | df['throughput_msg_per_s'] = df['throughput_msg_per_s'].astype(float) | ||
| 18 | |||
| 19 | mean_rtt = df['rtt_ms'].mean() | ||
| 20 | p95_rtt = df['rtt_ms'].quantile(0.95) | ||
| 21 | mean_throughput = df['throughput_msg_per_s'].mean() | ||
| 22 | |||
| 23 | print(f"Średnie RTT: {mean_rtt:.2f} ms") | ||
| 24 | print(f"RTT 95-percentyl: {p95_rtt:.2f} ms") | ||
| 25 | print(f"Średni throughput: {mean_throughput:.2f} msg/s") | ||
| 26 | |||
| 27 | plt.figure(figsize=(6,4)) | ||
| 28 | sns.barplot(x=['Variant A'], y=[mean_rtt], palette="Set2") | ||
| 29 | plt.title("Średnie RTT - wariant A") | ||
| 30 | plt.ylabel("RTT [ms]") | ||
| 31 | plt.tight_layout() | ||
| 32 | plt.savefig("output/rtt_mean_a.png") | ||
| 33 | plt.show() | ||
| 34 | |||
| 35 | plt.figure(figsize=(6,4)) | ||
| 36 | sns.barplot(x=['Variant A'], y=[p95_rtt], palette="Set3") | ||
| 37 | plt.title("RTT 95-percentyl - wariant A") | ||
| 38 | plt.ylabel("RTT [ms]") | ||
| 39 | plt.tight_layout() | ||
| 40 | plt.savefig("output/rtt_p95_a.png") | ||
| 41 | plt.show() | ||
| 42 | |||
| 43 | plt.figure(figsize=(6,4)) | ||
| 44 | sns.barplot(x=['Variant A'], y=[mean_throughput], palette="Set1") | ||
| 45 | plt.title("Średni throughput - wariant A") | ||
| 46 | plt.ylabel("Messages per second") | ||
| 47 | plt.tight_layout() | ||
| 48 | plt.savefig("output/throughput_a.png") | ||
| 49 | plt.show() | ||
