Repository navigation
feat(metrics): show engine generation speed - #273
Merged
Merged
Conversation
Parse the instantaneous tg figure from llama.cpp's print_timing lines as the engine output is captured (a line tee beside the log file), fold it into the sampler's history, and report it on the metrics API as an optional current reading and per-tick point. Bar, combined, gauge and table surfaces draw a Speed row whose sparkline scales to the window's high watermark in the default colour throughout, and the GPU utilisation series is relabelled GPU util to GPU.
The real llama.cpp line carries an elapsed-time prefix whose four dotted groups read as an IPv4 address to the no-cloud-identifiers check; the parser answers just as well without it.
Review of the rendered serve view: the renamed GPU labels left two dead columns in the block's label column, and the speed row cut its own columns rather than sharing the block's. - statLabelWidth sizes the shared label column to its longest label (seven for GPU mem, widening by the GPU index); threaded through the sparkline, gauge, active and speed rows and every caller - the speed figure now starts where the other rows' graphs start and the sparkline holds the sparklines' column however many digits the figure grows (fixed field spanning the gauge and percentage halves) - a lapsed figure on an engine that reports one reads 0.00 t/s rather than keeping the last burst's rate in front of a watching eye; only a never-reporting engine draws no row - dashBarLineW 25 to 23 so the trailing figure fits the tile
outofcoffee
force-pushed
the
feat/engine-generation-speed
branch
from
October 28, 2026 02:41
3b0b991 to
1b1aa53
Compare
The figure drops to 0.00 t/s on a lapse but the sparkline pinned the last burst to its right edge, so the row contradicted itself: a packed speed series discarded the quiet samples' positions and the trend's "now" kept claiming the engine was still generating. Keep the speed points on the window's time axis instead: one slot per sample, quiet slots drawn blank, pooled without closing the gaps. Each speedless tick slides the burst a column toward the past and leaves its own blank at the row's right edge, agreeing with the figure's zero. A stopped engine's edge stays legitimately full — its history froze when the engine did.
Fold the deltas into the main specs — engine-metrics, engine-activity, daemon-api and remote-metrics-bar-format — and move the change to the archive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Show the rate the engine reports for itself — tokens per second — on every metrics surface.
Closes #271
Summary
tgfigure from llama.cpp'sprint_timinglines out of the engine's captured output, and reports it as an optionalspeedreading on/v1/metricsplus per-tickspoints in the retained history. Engines that print no rate, stopped engines and engines quiet for a sampling interval simply omit the figure — absent, not zero.Speedrow: thet/sfigure and, where history is drawn, a sparkline whose glyph heights scale to the window's own high watermark and whose points all draw in the terminal's default colour — the 80/90% thresholds belong to utilisation percentages, and a rate has no ceiling to cross.GPU util/GPU N utilbecomeGPU/GPU N(memory keepsGPU mem).Implementation details
lineTeewraps the supervisor's log-file capture sink: raw bytes reach the log file untouched, and complete lines are additionally handed to an injectedOnOutputhook. One tee covers both capture paths (stderr and the pty pump's normalised stdout), so the parser reads lines where they are already assembled rather than re-reading the log. The hook must be wired beforeSupervisor.Start, which builds the sink as it launches.tg\s*=cannot matchtg_3s =, so the three-second average and prompt-evaluation rates never read as the current rate.Spec deltas live in the openspec change
engine-generation-speed(to be archived after merge).