Repository navigation
Show windowed BEAM CPU and RSS metrics in the TUI - #144
Merged
Merged
Conversation
Changes: - Replace platform-dependent ps percentages with user-plus-system CPU counter windows and current RSS with signed sample changes in Home and System. - Add independent Linux proc and macOS ps counter parsing, cached Linux units, explicit warm-up and unavailable states, and view-local monotonic baselines. - Bound OS command output and execution, terminate timed-out or interrupted children, and preserve process rows with compact CPU-window metadata. - Preserve virtual-memory details, document metric semantics, and add parser, lifecycle, layout, and reproducible workload and remote-node smoke checks. Validation: - Run rebar3 compile, fmt --check, xref, dialyzer, and git diff --check successfully. - Pass the full EUnit suite with 875 tests and zero failures; pass 14 focused runtime-metrics tests after the minimal-Linux cleanup fallback. - Pass 114 focused tests and workload, memory-allocation, and remote-identity smokes on macOS OTP 26, 27, and 28 and Linux OTP 28; pass the macOS OTP 29 focused suite and smoke. - Compare the same macOS BEAM PID with top: counter windows react to idle, single-worker, multi-worker, and stopped workloads and support values above 100 percent. - Measure 30 Home collections against the baseline: median collection time changes from 25.43 ms to 11.41 ms; this is a local observation, not a general performance guarantee. - Do not change the CLI JSON schema, push commits, or publish a release; scheduler-summary work follows separately.
Changes: - Reuse the existing wall-time samples and diagnostic pool validation to show separate online Normal and Dirty CPU busy percentages only when scheduler usage is enabled. - Keep the existing shortcut and default-off setting, add no sampler or registration, and attach the single measurement registration to the existing render worker so worker failure cannot leave it resident. - Re-establish first, resumed, invalid, and topology-changed scheduler windows without fabricated zero values; preserve other tools' registrations and avoid redundant startup samples. - Keep Home's 139-column summary within its existing height and preserve RSS changes in narrow System cells with documented IEC compact units. - Fix CPU baseline recovery after a failed Linux proc read and distinguish process-ranking warm-up from independent CPU warm-up in regression tests. - Update help and configuration reference without changing the public CLI or JSON contract. Validation: - Pass the complete EUnit suite: 883 tests, zero failures. - Pass 122 focused tests on macOS OTP 26, 27, 28, and 29 and Linux OTP 28, including sampling-call tracing, registration preservation, worker-crash cleanup, and layout checks. - Run rebar3 compile, fmt --check, xref, dialyzer, and git diff --check successfully; pass scripts/escript-smoke.sh including TUI EOF cleanup. - Exercise a real 139-column macOS TTY: pause/resume, the shared scheduler toggle, Home/System transitions, readable RSS changes, and clean quit. - Pass workload, memory-allocation, and remote-target identity smokes; the Linux OTP 28 process reaches about 100 percent with one worker and about 395 percent with four, then returns to idle. - Do not claim Linux OTP 29 validation: the cached OTP 29 container runtimes fail prim_tty initialization before the sampler runs. Linux OTP 26 and 27 were not available in this run. - Do not push, open a pull request, or publish a release.
Changes: - Integrate origin/main at e0189c2, including the task-first CLI 2.1.0 entrypoint, target rules, and public schemas while preserving the TUI metrics feature. - Remove the obsolete scheduler token argument from Home management, actions, and process navigation; keep registration ownership and release in the existing render worker. - Preserve the exported cleanup entrypoint's legacy four-item resource form while using the two-process resource form internally. - Replace compact-unit replacement passes with the existing formatter's number/unit split and reuse window_value for valid CPU-window text. - Keep equivalent lint-compliant guard semantics and add cleanup compatibility, registration preservation, compact-unit, and window-state regressions. Validation: - Pass the focused suite with 125 tests and zero failures. - Pass the full EUnit suite with 916 tests and zero failures using ERL_FLAGS='+S 4:4 +SDcpu 4:4'. - Pass compile, fmt --check, lint, xref, dialyzer, escript smoke including TUI EOF cleanup, and diff checks after the simplifications. - Previously pass generated documentation, public schema generation, 97 capture fixtures, 47 agent-workflow fixtures, packaged schemas, negative cases, and the isolated task-first agent workflow after integrating main. - Preserve both merge parents; update only the existing PR branch without changing production nodes or publishing a release.
zhongwencool
force-pushed
the
zw/tui-runtime-metrics
branch
from
October 5, 2026 10:19
b4c6898 to
100a615
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #144 +/- ##
==========================================
- Coverage 97.65% 95.02% -2.64%
==========================================
Files 27 34 +7
Lines 8452 9451 +999
==========================================
+ Hits 8254 8981 +727
- Misses 198 470 +272 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Replace platform-dependent
ps %CPU/%MEMfields with actual-window BEAM process CPU (user + system, 100% per logical CPU), current RSS, and signed RSS changes in Home and System.Use Linux proc counters with cached tick/page units and controlled macOS
pscounters, with bounded output, deadlines, child cleanup, and independent unavailable/warm-up states.Show separate Normal/Dirty CPU scheduler busy summaries only with the existing scheduler-usage toggle. Reuse its samples and single registration; keep the default off and release the registration with the existing render worker.
Preserve process-row capacity, fix the 139-column summary edge, retain RSS changes in narrow System cells, and document measurement semantics and failure recovery.
Simplify Home management by removing the obsolete token argument; retain legacy cleanup compatibility, use direct compact-unit formatting, and reuse CPU-window value formatting.
Integration
Merged the latest
main(e0189c2, CLI 2.1.0) into this branch. The task-first CLI, explicit targets, schema contracts, and release version remain intact. The PR diff is limited to this TUI metrics feature and its tests/docs.Validation after merging main
ERL_FLAGS='+S 4:4 +SDcpu 4:4'.rebar3 compile,rebar3 fmt --check,rebar3 lint,rebar3 xref,rebar3 dialyzer,rebar3 docs, andgit diff --check: passed.scripts/escript-smoke.sh: passed, including TUI stdin-EOF cleanup.Earlier feature/runtime validation
Boundaries
No new public CLI flags or JSON fields, load averages, historical storage, automatic alerts, container-budget percentages, or scheduler-performance redesign. No production node changes or release publication. Linux OTP 26/27 were not exercised locally; cached Linux OTP 29 runtimes failed
prim_ttyinitialization before sampling, so a complete Linux OTP matrix is not claimed. CI validation remains separate from these local results.