RC: (update) script to measure network in Megabits per second (Mbps)

This commit is contained in:
2026-03-31 13:58:36 +00:00
parent 3f8e8f545a
commit f5dea6770e

View File

@@ -60,11 +60,13 @@ def background_poller():
hist_cpu.append(round(cpu_pct, 1))
prev_idle, prev_total = idle, total
# 2. Network Delta Calculation
# 2. Network Delta Calculation (Changed to Mbps)
rx_now = int(run_cmd(f"cat /sys/class/net/{IFACE}/statistics/rx_bytes") or 0)
tx_now = int(run_cmd(f"cat /sys/class/net/{IFACE}/statistics/tx_bytes") or 0)
hist_rx.append(round((rx_now - rx_prev) / (1024 * 1024), 2))
hist_tx.append(round((tx_now - tx_prev) / (1024 * 1024), 2))
# Multiply by 8 for bits, divide by 1,000,000 for Megabits
hist_rx.append(round(((rx_now - rx_prev) * 8) / 1000000, 2))
hist_tx.append(round(((tx_now - tx_prev) * 8) / 1000000, 2))
rx_prev, tx_prev = rx_now, tx_now
# 3. RAM Snapshot