From 31cc2c0e92e70f119e8cbd351e4c204256a9886d Mon Sep 17 00:00:00 2001
From: Pbopbo
Date: Tue, 7 Apr 2026 16:54:05 +0200
Subject: [PATCH] more plotting
---
plot_combined.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/plot_combined.py b/plot_combined.py
index b668eb7..f0d1ff1 100644
--- a/plot_combined.py
+++ b/plot_combined.py
@@ -235,6 +235,15 @@ def plot_combined(alsa_file, perf_file, latency_file, out_path):
ax2.plot(perf_aligned, sample_means, label="sample mean", linewidth=1, alpha=0.8, color='green')
ax2.plot(perf_aligned, write_means, label="write mean", linewidth=1, alpha=0.8, color='orange')
ax2.plot(perf_aligned, loop_means, label="loop mean", linewidth=1, alpha=0.8, color='red')
+
+ # Add moving average for loop mean
+ if len(loop_means) >= 10:
+ window_size = min(50, len(loop_means) // 10)
+ moving_avg = np.convolve(loop_means, np.ones(window_size)/window_size, mode='valid')
+ ma_seconds = perf_aligned[window_size-1:]
+ ax2.plot(ma_seconds, moving_avg, label=f"loop mean moving avg (window={window_size})",
+ linewidth=2, color='darkred', alpha=0.9)
+
ax2.set_ylabel("Duration (ms)")
ax2.set_title("Performance Metrics")
ax2.legend()