7.1 KiB
Stats agent report (branch ap/stats)
Task: better in-game statistics and a stats overlay the owner can arrange, a session summary, a benchmark mode, a CSV frame log, tidier overlay settings, screenshots and an honest README.
What changed
| Area | Files |
|---|---|
| The numbers: rolling windows, percentile maths, collector, overlay "cells", summary, CSV | new engine/framegen/stats.py |
Wiring: per-frame, per-stage, dropped/repeated counts, benchmark stop, P summary |
engine/framegen/pipeline.py |
Stage timers (upscale, look, present), config in words, Bar style, result card, P key |
engine/framegen/io.py, fsr.py (GpuTimer gets an on_sample callback) |
| Drawing: cells in fixed-width slots, Detailed rows in 1-2 columns, Bar, result card | engine/framegen/hud.py |
Settings: Bar style, bar_position, overlay_colours, stats_window, 17 stat_<item> rows, session_summary, frametime_log; Overlay tab headings Stats / Items / Graphs / Session |
engine/framegen/settings.py |
Menu: bar in the Performance overlay row, a "Save a stats summary" action on Home |
engine/framegen/menu.py |
--benchmark, --result-card, --frametime-log, --stats-dir, collector set-up, summaries on exit |
engine/run.py |
oslayer.data_dir() (~/.local/share/smoovplay) |
engine/framegen/oslayer.py |
| Tests (headless): maths, collector, cells, summary, CSV, hud, pipeline wiring with a fake interpolator, settings and menu | engine/tests/test_stats*.py |
| Headless sample renderer (made-up numbers, labelled) | engine/devtools/render_stats_samples.py |
No Rust touched. The Overlay tab already existed (the task said Display); the stats rows are grouped under headings there.
Numbers (see README "Statistics")
fps, game fps, generated share, frametime avg/worst, 1% and 0.1% low (mean of the worst 1% / 0.1% of frametimes; -- until
100 / 1000 frames are in the window), jitter (mean frame-to-frame change), dropped / repeated / late, per-stage cost (capture
wait, AI frame, upscaler, look, present; average, 95th percentile, worst), delay median and p95, GPU load / VRAM / temp / power
(the existing nvidia-smi reader, now shared; one process, once a second), CPU load (/proc/stat once a second), the settings
in words, and the collector's own cost (about 5-23 us a frame, about 0.5-0.9 ms a refresh in the real runs).
The engine's start-up (first frames, until a start-up backlog has cleared, at most 10 s) is left out of everything.
Layout
Each number has a row (Style's own / Show / Hide) under Overlay > Items; Minimal and Bar flow them in a line, Detailed gives each a row; Bar runs along the top or bottom edge and drops what does not fit; colours green/yellow/red on fps, lows, frametime, load, temperature, delay (can be turned off). Numbers sit in slots as wide as their widest value (tested: the image does not change size as digits change). Saved settings from before load unchanged (tested).
Session summary, benchmark, CSV
summit-session-<time>.json + .txt in ~/.local/share/smoovplay/sessions (--stats-dir): written on stop, on P
(not used by io.py before) and from the Home tab's "Save a stats summary". Includes settings in use and each settings change with
fps / 1% low before and after. --benchmark SECONDS (needs --display or --out) runs a fixed time with a countdown cell,
loops a file source (played in real time), writes the summary (with --results FILE, its table goes into that file after any
test-mode report and the JSON beside it: extends the existing flag, does not duplicate it) and shows the card
(--result-card, 8 s). --frametime-log [FILE] / "Log every frame (CSV)" writes MangoHud-named columns plus generated.
What I verified, and how
cd engine && env -u PYTHONPATH /root/.cache/summit-venv/bin/python -m pytest tests -q: 150 passed, 1 skipped (the skip was there before).- Real engine runs on the GPU VM (own directory /home/user/summit-stats, X11 :0, RTX 3090 shared with another service so
numbers are noisy and often "behind", software OpenGL, 1280x720 stand-in game recording, RIFE 4.22 lite with
--no-graph, 4x = 120 fps out): all four styles, the countdown, the result card, the in-game menu's Overlay tab, a session with two live settings changes and the P key, a window-less--outbenchmark. Every screenshot below was looked at. - Pillow is not in the VM's engine venv: I copied the host venv's Pillow into
/home/user/summit-stats/pyliband put it on PYTHONPATH. The other VM directories were only read (recordings from /home/user/engine; weights downloaded again into my own run).
Screenshots (docs/media/stats/)
Real engine output, window captured on the VM (1280x720 window, overlay scale 150% in the settings file):
real-minimal.png, real-detailed.png, real-graphs.png, real-bar.png (styles; a stand-in 2D game), real-bench-countdown.png
(Bar with the countdown), real-bench-card.png (result card over the last picture), real-menu-overlay-stats.png and
real-menu-overlay-items.png (in-game menu, Overlay tab, pressed with XTest keys).
Text of real runs: real-benchmark-summary.txt/.json (20 s benchmark), real-session-summary.txt/.json (48 s, two changes of
settings, written by the engine), rendered to real-*-summary-text.png (the .txt rendered as an image by me), and
real-frametime-log-head.csv (first rows of the real CSV).
Headless renders, MADE-UP numbers labelled SAMPLE DATA: headless-minimal|detailed|graphs|bar|card.png.
Not done / not tested / things to know
- Only a video file on X11 was run. Not run: Remote Play, a capture card, window capture over a real game, Wayland, Windows.
- CPU load on Windows needs psutil (not tried); GPU numbers need nvidia-smi (AMD/Intel get none).
- The CSV columns follow MangoHud's log from memory (header lines too); not checked with MangoHud's own tools. CPU temp, memory clock are 0.
- "Present" includes waiting for the screen when vsync is on. "Upscaler" is GL timer queries (or RTX VSR's CUDA events); with a look on, the main timer ends before the look and the look has its own query, so the existing end-of-run "GPU time to draw each frame" log line now reads upscale-only in that case. NVIDIA VFG/VSR timings: the overlay shows them, the summary adds NVIDIA's sharing note for VFG.
- In the real runs the pipeline was often behind at 120 fps (shared GPU), so dropped/late counts are high; in the 48 s session the capture wait p95 was about 2 s (a start-up backlog on a real-time file source decays slowly). I did not chase this further; the numbers are reported as measured. The first benchmark run (cold model download) showed the start-up stall and led to the warm-up rule.
- The 17 item rows add length to the Overlay tab (it scrolls); the launcher's Settings page gets the new rows automatically through specs_json but I did not look at it (not mine). The menu in a 1280 px window is cut at the right (existing layout, not changed).
- Key P works only in the video window; over a game use the Home tab action.
- The overlay's old
detailstext path (Model / AI frame / Extra frames rows) is superseded by the cells; kept only for callers without cells.