Repository navigation
[5/6] Show app CPU and memory usage on demand - #173
BinaryBearsLLC wants to merge 5 commits into
Conversation
|
Landed in #184 as e8dd317 with your authorship. Verified: sampling runs only while the card is expanded, the page visible, the app active and the window key; the libproc work stays inside a private actor; PID reuse is handled through the kernel start time; the Mach timebase conversion is tested. Three fixes on top (4ffd960, e995224, b6e2345): about 230 root-owned processes return EPERM on every Mac, so the "could not be measured" note was permanent, and it now tells protected processes apart from churn; pausing wiped the list and the baseline, now the last sample stays on screen; an app group gaining a helper mid-interval reported no CPU at all, now it sums the known members and marks the total partial. Plus the "%lld processes" key the rows already used (1bf58f8). Ships in 3.1.0. |
…ocess notes In momenbasel#173 by @BinaryBearsLLC every proc_pidinfo failure other than ESRCH counted as "unavailable", and on any non-root Mac roughly 230 root-owned processes fail with EPERM, so the orange "Some protected or changing processes could not be measured." note never went away and a reader could not tell a permission limit from churn. EPERM now feeds a neutral "System processes are not listed. Use Activity Monitor for those." line. Processes that started or stopped since the previous sample, together with reads that failed for any other reason, feed a separate note that only shows for the sample it describes and never on the first sample, which has no baseline. The old key is replaced in all twelve catalogs.
…ng is paused momenbasel#173 by @BinaryBearsLLC cleared the consumer list, icons and names whenever sampling paused, so a Cmd-Tab away and back emptied the Apps and processes list and made the user wait two samples before CPU values came back. Pausing now only cancels the sampler. The previous sample stays visible under the "Live updates paused" notice, and resuming creates a new session-scoped sampler so the baseline resets and the first new interval cannot be fed from stale counters. The lifecycle test asserts the retained sample, that a cancelled sampler publishes nothing, and the fresh baseline on resume.
In momenbasel#173 by @BinaryBearsLLC one member without an interval yet turned a whole group's CPU into unknown, so apps that spawn helpers every few seconds (browsers, Xcode) flickered between a value and a dash on every sample. A group now keeps the sum of its measured members and is marked partial for that sample. The row shows the value with a trailing plus and explains the mark on hover; a group with no measured member still reads as unknown. The grouping test covers the partial sum, the unknown case and the complete case.
The process rows from momenbasel#173 by @BinaryBearsLLC interpolate the member count into "%lld processes", but only the "1 process" form was added to the catalogs, so the plural rendered from its key. All twelve locales get the key; German and Simplified Chinese get translations for both forms, the rest keep the English fallback the repo uses for new keys.
Part 5 of 6 — depends on #169, #170, #171, #172. Please keep this PR in draft until the preceding parts are merged. Its current Files changed tab includes those earlier changes.
Review and merge order: #169 → #170 → #171 → #172 → #173 → #174.
Before merging: refresh this branch against the updated main, retaining only this part’s commit. If earlier parts were squash-merged or rebased, reapply only the linked commit onto updated main; do not merge the cumulative diff as-is.
Review this part’s commit.
What does this PR do?
Adds a collapsible CPU–Memory card with a compact overview and an expandable Apps and processes list.
Testing
120 XCTest tests passed, covering CPU deltas, process grouping, PID reuse and monitoring lifecycle; universal build succeeded on macOS 26.6.2 (Apple Silicon). Tested on macOS Ventura 13.6 (22G120, Apple Silicon VM). GUI checks passed for live readings, sorting/search, pause/resume and the independent menu-bar monitor, including a minimized window. Standalone Ventura checks also exercised sampling, CPU math, grouping and timer ownership.
Screenshots