Skip to content

feat: add simslim top — live fleet monitor with per-daemon drill-down - #17

Merged
Interlap01 merged 1 commit into
mainfrom
top-command
Jul 24, 2026
Merged

feat: add simslim top — live fleet monitor with per-daemon drill-down#17
Interlap01 merged 1 commit into
mainfrom
top-command

Conversation

@Interlap01

Copy link
Copy Markdown
Contributor

What

simslim top — a top(1) for the simulator fleet, plus simslim list --booted.

Fleet view (live, 2s refresh):

SIMULATOR                      OS     STATE   PROC    CPU      RAM     DISK
iPad Air 13-inch (M2) · 0D38E… 17.5   stock    181     1%     3.4G     2.8G
iPhone 16 · 5D8D68E7           18.3   stock    167     4%     3.2G     6.1G
iPhone 17 · AEE905BA           26.4   slim      77     0%     1.3G     4.4G
iPhone 17 Pro · 7D5CE770       27.0   slim      64     1%   961.8M     4.4G
7 booted · total 16.8G · ↑↓ select · ↵ open · sort n·o·s·p·c·m·d · q quit
  • Enter a row (or simslim top <udid>) → that simulator's per-daemon RAM/CPU breakdown, scrollable.
  • Sorting on every column (n·o·s·p·c·m·d, press again to flip); OS uses a version-aware comparator so 9.0 < 26.4.
  • Responsive: the name column flexes to the terminal width.
  • --json / piped output: one-shot snapshots (fleet or per-daemon) — same JSON-contract style the GUI decodes.

How

  • Library stays dependency-free. MeasureProcesses keeps the per-process footprint+cpu that measureTree used to discard (one shared ps/top snapshot); fleet.go's FleetSnapshot composes booted devices + slim status + MeasureMany, fanning the per-device status reads out in parallel so first paint waits on the slowest device, not the sum.
  • TUI is CLI-only (cmd/simslim/top.go): bubbletea + lipgloss join urfave/cli as the CLI's deps; importers of the library inherit none of it.
  • Robustness: cursor anchors to the selected sim's UDID across live re-sorts; transient refresh errors keep the last snapshot and report in the footer; disk (du) sweeps are TTL'd (30s) and guarded against overlap; /dev/null-style non-TTYs correctly fall back to static output via go-isatty.

Also: simslim list --booted filters the listing (text and --json) to booted simulators.

Testing

  • Pure unit tests as usual (no sim boots): ps parsing, tree aggregation with cycles, sort/reanchor/version-compare logic, formatting, static render.
  • make check green; smoke-tested live against 7 booted simulators (mixed stock/slim, iOS 17.5–27.0).

A top(1) for the simulator fleet: every booted simulator with its OS,
slim state, process count, CPU, RAM, and disk, refreshing live. Enter a
row (or pass a UDID) to drill into that simulator's per-daemon footprint.
Columns sort via n/o/s/p/c/m/d with a version-aware OS comparator; the
name column flexes to the terminal width. --json and piped output emit
one-shot snapshots, keeping the JSON contract for the GUI.

Library side stays dependency-free: MeasureProcesses keeps per-process
footprint+cpu from the shared ps/top snapshot, and FleetSnapshot
composes booted devices, slim status (fanned out per device), and
MeasureMany. The TUI (bubbletea + lipgloss, CLI-only deps) anchors the
cursor by UDID across live re-sorts, keeps the last snapshot on
transient refresh errors, and guards disk sweeps against overlap.

Also adds `simslim list --booted` to filter the listing to booted
simulators.
@Interlap01
Interlap01 merged commit 26cd202 into main Jul 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant