From b3ef214e7257a1e5b674f8b1f002f05e78b090b8 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 21 Aug 2026 18:25:59 +0200 Subject: [PATCH] Added total announce/pr frequency stats --- RNS/Reticulum.py | 4 ++++ RNS/Transport.py | 14 ++++++++++++++ RNS/Utilities/rnstatus.py | 14 ++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index 6734df7b..5cc10664 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -1569,10 +1569,14 @@ class Reticulum: stats["atxb"] = RNS.Transport.announce_txb stats["arxs"] = RNS.Transport.announce_speed_rx stats["atxs"] = RNS.Transport.announce_speed_tx + stats["arxf"] = RNS.Transport.announce_freq_rx + stats["atxf"] = RNS.Transport.announce_freq_tx stats["prxb"] = RNS.Transport.pr_rxb stats["ptxb"] = RNS.Transport.pr_txb stats["prxs"] = RNS.Transport.pr_speed_rx stats["ptxs"] = RNS.Transport.pr_speed_tx + stats["prxf"] = RNS.Transport.pr_freq_rx + stats["ptxf"] = RNS.Transport.pr_freq_tx stats["rxqt"] = qsnapshot[0] stats["rxqd"] = qsnapshot[1][0] stats["rxqa"] = qsnapshot[1][1] diff --git a/RNS/Transport.py b/RNS/Transport.py index 4f9e09de..fdd434fb 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -273,8 +273,12 @@ class Transport: speed_tx = 0 announce_speed_rx = 0 announce_speed_tx = 0 + announce_freq_rx = 0 + announce_freq_tx = 0 pr_speed_rx = 0 pr_speed_tx = 0 + pr_freq_rx = 0 + pr_freq_tx = 0 traffic_captured = None lowest_interface_bitrate = None highest_interface_bitrate = None @@ -578,6 +582,7 @@ class Transport: rxb = 0; txb = 0; rxs = 0; txs = 0; arxb = 0; atxb = 0; arxs = 0; atxs = 0; prxb = 0; ptxb = 0; prxs = 0; ptxs = 0; + iafreq = 0; oafreq = 0; ipfreq = 0; opfreq = 0 for interface in Transport.interfaces: if not hasattr(interface, "parent_interface") or interface.parent_interface == None: @@ -602,6 +607,11 @@ class Transport: prxb += prx_diff; cprxs = (prx_diff*8)/ts_diff ptxb += ptx_diff; cptxs = (ptx_diff*8)/ts_diff + iafreq += interface.incoming_announce_frequency() + oafreq += interface.outgoing_announce_frequency() + ipfreq += interface.incoming_pr_frequency() + opfreq += interface.outgoing_pr_frequency() + interface.current_rx_speed = crxs; rxs += crxs interface.current_tx_speed = ctxs; txs += ctxs interface.current_arx_speed = carxs; arxs += carxs @@ -627,10 +637,14 @@ class Transport: Transport.announce_txb += atxb Transport.announce_speed_rx = arxs Transport.announce_speed_tx = atxs + Transport.announce_freq_rx = iafreq + Transport.announce_freq_tx = oafreq Transport.pr_rxb += prxb Transport.pr_txb += ptxb Transport.pr_speed_rx = prxs Transport.pr_speed_tx = ptxs + Transport.pr_freq_rx = ipfreq + Transport.pr_freq_tx = opfreq except Exception as e: RNS.log(f"An error occurred while counting interface traffic: {e}", RNS.LOG_ERROR) diff --git a/RNS/Utilities/rnstatus.py b/RNS/Utilities/rnstatus.py index 98d5a375..b7da9db9 100644 --- a/RNS/Utilities/rnstatus.py +++ b/RNS/Utilities/rnstatus.py @@ -733,8 +733,11 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json= prxspct = min(100.0, (stats["prxs"] / stats["rxs"])*100.0) if stats["rxs"] and stats["prxs"] else 0.0 ptxspct = min(100.0, (stats["ptxs"] / stats["txs"])*100.0) if stats["txs"] and stats["ptxs"] else 0.0 - prxstat = prxb_str+" "+RNS.prettyspeed(stats["prxs"])+f", {int(prxspct)}% of flow" - ptxstat = ptxb_str+" "+RNS.prettyspeed(stats["ptxs"])+f", {int(ptxspct)}% of flow" + prxfstr = RNS.prettyfrequency(stats["prxf"]) + ptxfstr = RNS.prettyfrequency(stats["ptxf"]) + + prxstat = prxb_str+" "+RNS.prettyspeed(stats["prxs"])+f", {int(prxspct)}% of flow, {prxfstr}" + ptxstat = ptxb_str+" "+RNS.prettyspeed(stats["ptxs"])+f", {int(ptxspct)}% of flow, {ptxfstr}" print(f"\n Path Rqs. : {ptxstat}\n {prxstat}") if astats: @@ -748,8 +751,11 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json= arxspct = min(100.0, (stats["arxs"] / stats["rxs"])*100.0) if stats["rxs"] and stats["arxs"] else 0.0 atxspct = min(100.0, (stats["atxs"] / stats["txs"])*100.0) if stats["txs"] and stats["atxs"] else 0.0 - arxstat = arxb_str+" "+RNS.prettyspeed(stats["arxs"])+f", {int(arxspct)}% of flow" - atxstat = atxb_str+" "+RNS.prettyspeed(stats["atxs"])+f", {int(atxspct)}% of flow" + arxfstr = RNS.prettyfrequency(stats["arxf"]) + atxfstr = RNS.prettyfrequency(stats["atxf"]) + + arxstat = arxb_str+" "+RNS.prettyspeed(stats["arxs"])+f", {int(arxspct)}% of flow, {arxfstr}" + atxstat = atxb_str+" "+RNS.prettyspeed(stats["atxs"])+f", {int(atxspct)}% of flow, {atxfstr}" print(f"\n Announces : {atxstat}\n {arxstat}")