debug: add bytes_received and raw_packets to viz stats
Validate and Test / validate-patches (push) Failing after 12s
Validate and Test / validate-patches (push) Failing after 12s
This commit is contained in:
@@ -74,12 +74,14 @@ def main():
|
|||||||
|
|
||||||
frames_sent = 0
|
frames_sent = 0
|
||||||
frames_dropped = 0
|
frames_dropped = 0
|
||||||
|
bytes_received = 0
|
||||||
|
|
||||||
last_refresh = time.monotonic()
|
last_refresh = time.monotonic()
|
||||||
stats_last_write = time.monotonic()
|
stats_last_write = time.monotonic()
|
||||||
fps_sample_start = time.monotonic()
|
fps_sample_start = time.monotonic()
|
||||||
fps_sample_frames = 0
|
fps_sample_frames = 0
|
||||||
events_processed = 0
|
events_processed = 0
|
||||||
|
raw_packets = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
now = time.monotonic()
|
now = time.monotonic()
|
||||||
@@ -94,8 +96,10 @@ def main():
|
|||||||
if fd == sock.fileno() and (flags & POLLIN):
|
if fd == sock.fileno() and (flags & POLLIN):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
data, _ = sock.recvfrom(SOCK_BUFFER)
|
data, addr = sock.recvfrom(SOCK_BUFFER)
|
||||||
buf += data
|
buf += data
|
||||||
|
bytes_received += len(data)
|
||||||
|
raw_packets += 1
|
||||||
except BlockingIOError:
|
except BlockingIOError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -149,14 +153,14 @@ def main():
|
|||||||
|
|
||||||
if now - stats_last_write >= 2.0:
|
if now - stats_last_write >= 2.0:
|
||||||
fps = fps_sample_frames / (now - fps_sample_start) if (now - fps_sample_start) > 0 else 0
|
fps = fps_sample_frames / (now - fps_sample_start) if (now - fps_sample_start) > 0 else 0
|
||||||
_write_stats(frames_sent, frames_dropped, fps, len(active_notes), events_processed)
|
_write_stats(frames_sent, frames_dropped, fps, len(active_notes), events_processed, bytes_received, raw_packets)
|
||||||
stats_last_write = now
|
stats_last_write = now
|
||||||
fps_sample_start = now
|
fps_sample_start = now
|
||||||
fps_sample_frames = 0
|
fps_sample_frames = 0
|
||||||
events_processed = 0
|
events_processed = 0
|
||||||
|
|
||||||
|
|
||||||
def _write_stats(sent, dropped, fps, active_count, events):
|
def _write_stats(sent, dropped, fps, active_count, events, bytes_rcv, packets):
|
||||||
import json
|
import json
|
||||||
try:
|
try:
|
||||||
with open(STATS_FILE, "w") as f:
|
with open(STATS_FILE, "w") as f:
|
||||||
@@ -166,6 +170,8 @@ def _write_stats(sent, dropped, fps, active_count, events):
|
|||||||
"fps": round(fps, 1),
|
"fps": round(fps, 1),
|
||||||
"active_notes": active_count,
|
"active_notes": active_count,
|
||||||
"midi_events": events,
|
"midi_events": events,
|
||||||
|
"bytes_received": bytes_rcv,
|
||||||
|
"raw_packets": packets,
|
||||||
"ts": time.time()
|
"ts": time.time()
|
||||||
}, f)
|
}, f)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|||||||
Reference in New Issue
Block a user