Skip to content

List every process, not the first quarter - #34

Open
edward-mcnair wants to merge 1 commit into
kemalandic:mainfrom
edward-mcnair:fix-process-count
Open

edward-mcnair wants to merge 1 commit into
kemalandic:mainfrom
edward-mcnair:fix-process-count

Conversation

@edward-mcnair

Copy link
Copy Markdown

What does this PR do?

proc_listallpids returns a count of PIDs, not bytes: libproc divides by sizeof(int) itself. fetchRawSnapshots() divided it by sizeof(pid_t) again, so the process widget scanned only the first quarter of running processes and often missed the busiest ones. The buffer was also a fixed 1024 entries.

  • The listing moves into ProcessMonitorService.allPIDs(), sized from the current count with headroom, and uses the count as returned.

Tests: ProcessListingTests: the listing covers at least three quarters of the system's own count (allowing for processes that start or exit in between) and includes the test's own PID.

Screenshots

No UI change. The Top Processes widget simply finds processes it used to miss.

Checklist

  • Tested on macOS 14+ (macOS 27)
  • No third-party dependencies added
  • Follows existing code style (swift-format lint clean)

🤖 Generated with Claude Code

proc_listallpids returns a count of PIDs, not bytes (libproc divides by
sizeof(int) itself). Dividing it by sizeof(pid_t) again meant the process
widget scanned only the first quarter of running processes, so it often
missed the busiest ones. The buffer was also a fixed 1024 entries; it is
now sized from the current count.

The listing moves into ProcessMonitorService.allPIDs() so a test can check
that it covers every running process, including the test's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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