Repository navigation
(trace): record terminal render-path counters (#175) - #422
Conversation
A renderer that burned a core could not be diagnosed: the activity trace had nothing on the terminal render path. Add a render.stats line per session per second, gated on window.ATRACE, with chunks, writes, batch size and glyph atlas rebuilds. Off, each site is one flag read. Closes #175
|
Reviewing |
devsuitup
left a comment
There was a problem hiding this comment.
Adversarial review at d3e97f9: 0 blocking. With the trace off, each added site costs one window.ATRACE read. The hoisted isHiddenSingleViewSession call keeps its entry short-circuit, so it adds no work. With the trace on, one timer serves the window and the Map is cleared on every emit. Atlas listeners belong to each addon instance and are disposed with it. Being fixed: no test covers the reveal replay or two sessions in one window, a two-line source comment, and doc precision on hiddenChunks, line volume and rekey.
Tests for the reveal replay write, separate per-session counts and data for a session without a terminal entry. Trim the comments and document hiddenChunks, the line volume and a rekey straddling a window.
devsuitup
left a comment
There was a problem hiding this comment.
Re-review at 89bcd6a (delta from d3e97f9): 0 blocking. Three tests are added: the reveal replay, two sessions in one window, and a session with no entry. Each goes red under its mutation: deleting the replay count, or dropping !!entry &&. The source comment is down to one pointer line, and the doc gives the hiddenChunks definition, line volume and the rekey case. Ready once CI is green.
Closes #175.
The activity trace had no category on the terminal render path, so a renderer burning a core could not be told apart as legitimate load or an atlas repaint loop. With Debug mode on,
public/terminal-manager.jsnow counts per session and sends onerender.statsline per session per second:ms,chunks,chars,hiddenChunks,writes,writeChars,maxBatchChunks,maxBatchChars,atlasChanges,atlasCanvases.Cost when off: each site is one
window.ATRACEread. No counter object, no timer, no clock read per write. When on, a write costs an integer increment; one timer is armed by the first event of a window and is not re-armed while the session is silent; a report is dropped if the trace was switched off meanwhile.Docs:
docs/activity-trace.md(field table, a reading recipe, the cost paragraph),.ai/contexts/ipc-bridge.md. CHANGELOG entry under New. No change to the flush cap or the WebGL policy.Tests:
test/terminal-render-stats.test.js(9 tests; the first 6 were red before the change). Mutations, each turning the suite red: handleTerminalData guard removed,writesnot incremented,atlasChangesnot incremented, emit ignoring ATRACE, flush counted with the trace off, hidden flag inverted, replay count deleted,!!entrycheck dropped.task checkgreen in the worktree.Not verified: a live Electron run (the atlas events are driven by a stub in jsdom; the real WebGL addon's event firing is assumed from its API).