fix indentation and debug: add pipeline counters
Validate and Test / validate-patches (push) Failing after 13s
Validate and Test / validate-patches (push) Failing after 13s
This commit is contained in:
@@ -82,6 +82,9 @@ def main():
|
||||
fps_sample_frames = 0
|
||||
events_processed = 0
|
||||
raw_packets = 0
|
||||
semicolon_hits = 0
|
||||
midi_matched = 0
|
||||
changed_true = 0
|
||||
|
||||
while True:
|
||||
now = time.monotonic()
|
||||
@@ -104,17 +107,20 @@ def main():
|
||||
pass
|
||||
|
||||
while b";" in buf:
|
||||
semicolon_hits += 1
|
||||
raw_msg, buf = buf.split(b";", 1)
|
||||
msg = raw_msg.decode().strip()
|
||||
parts = msg.split()
|
||||
if not parts:
|
||||
print(f"[viz] empty parts: {msg!r}", flush=True)
|
||||
continue
|
||||
if parts[0] != "midi":
|
||||
print(f"[viz] skipping: {msg!r}", flush=True)
|
||||
print(f"[viz] not midi: {msg!r}", flush=True)
|
||||
continue
|
||||
if len(parts) < 3:
|
||||
print(f"[viz] too short: {parts}", flush=True)
|
||||
continue
|
||||
midi_matched += 1
|
||||
status = int(parts[1])
|
||||
note = int(parts[2])
|
||||
vel = int(parts[3]) if len(parts) >= 4 else 0
|
||||
@@ -129,6 +135,7 @@ def main():
|
||||
active_notes.discard(note)
|
||||
changed = True
|
||||
if changed:
|
||||
changed_true += 1
|
||||
events_processed += 1
|
||||
params = render(active_notes)
|
||||
if params != last_sent_params:
|
||||
@@ -160,14 +167,14 @@ def main():
|
||||
|
||||
if now - stats_last_write >= 2.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, bytes_received, raw_packets)
|
||||
_write_stats(frames_sent, frames_dropped, fps, len(active_notes), events_processed, bytes_received, raw_packets, semicolon_hits, midi_matched, changed_true)
|
||||
stats_last_write = now
|
||||
fps_sample_start = now
|
||||
fps_sample_frames = 0
|
||||
events_processed = 0
|
||||
|
||||
|
||||
def _write_stats(sent, dropped, fps, active_count, events, bytes_rcv, packets):
|
||||
def _write_stats(sent, dropped, fps, active_count, events, bytes_rcv, packets, semi, matched, changed):
|
||||
import json
|
||||
try:
|
||||
with open(STATS_FILE, "w") as f:
|
||||
@@ -179,6 +186,9 @@ def _write_stats(sent, dropped, fps, active_count, events, bytes_rcv, packets):
|
||||
"midi_events": events,
|
||||
"bytes_received": bytes_rcv,
|
||||
"raw_packets": packets,
|
||||
"semicolon_hits": semi,
|
||||
"midi_matched": matched,
|
||||
"changed_true": changed,
|
||||
"ts": time.time()
|
||||
}, f)
|
||||
except OSError:
|
||||
|
||||
Reference in New Issue
Block a user