https://gitlab.synchro.net/main/sbbs/-/commit/9f0bfde96ee70ab98c147c33
Added Files:
src/doors/termgfx/stats.c stats.h src/doors/termgfx/test/test_stats.c Modified Files:
src/doors/syncdoom/syncdoom.c src/doors/syncduke/syncduke_io.c src/doors/termgfx/CMakeLists.txt src/doors/termgfx/test/CMakeLists.txt
Log Message:
termgfx: share the Ctrl-S stats row's window and fields
SyncDOOM, SyncDuke and SyncRetro each grew their own copy of the same
status strip: a rolling ~2s window over emitted frames and wire bytes, and
a readout starting
" <tier> <fps>fps <rate> lag <cur>/<min>ms depth <n>[/auto]"
before each door appends its own fields. Three copies, three chances to
drift, and they had drifted: SyncRetro printed raw KB/s, so a fast link
read "1382KB/s" where its siblings read "1.3MB/s", and it clamped none of
its numbers, so an outlier sample could widen the strip past the row and
wrap it onto the game view.
termgfx/stats.[ch] holds the part that has to read the same everywhere --
the window arithmetic (termgfx_stats_frame/_roll), the throughput token
that abbreviates past 999KB/s, the shared head, and the " evdev/nat" and
" x2" tokens SyncDOOM and SyncDuke had a copy of each. What stays in the
doors is painting: they disagree about which row is free, how output
reaches the wire, and what else competes for the row -- SyncRetro shares
it with a volume toast.
The strips are byte-identical to before except SyncRetro's, which gains
the abbreviation and the clamps. SyncDuke's stderr log line keeps raw
KB/s deliberately: a log is grepped and plotted, where a unit that changes
with the value is a nuisance; only the strip, where width costs a column, abbreviates.
SyncRetro's own half of this landed in the working tree ahead of this
commit, with the idle-timeout change earlier in the batch -- so this adds
the module it already calls, and converts the other two.
test_stats covers the KB/s-to-MB/s threshold either side of 999, the
clamps, the window (including across a millisecond-clock wrap) and both
tokens. Only MSVC was compiled here; uncrustify was not available on that machine, so the new code was written to the house style by hand.
Co-Authored-By: Claude Opus 4.8 (1M context) <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net