Skip to content

Fix running and blocked process count for AIX#2019

Merged
shirou merged 2 commits intoshirou:masterfrom
pgimalac:pgimalac/aix-load-misc-procs-running
Mar 8, 2026
Merged

Fix running and blocked process count for AIX#2019
shirou merged 2 commits intoshirou:masterfrom
pgimalac:pgimalac/aix-load-misc-procs-running

Conversation

@pgimalac
Copy link
Copy Markdown
Contributor

@pgimalac pgimalac commented Mar 6, 2026

Update the load.Misc implementation on AIX to fix running and blocked process number.

SACTIVE means active in memory, but it includes sleeping processes, so the current implementation is not correct, it basically counts every process (and only counts processes, while I believe the Linux implementation rather counts threads). SSTOP means stopped by a signal, not blocked on IO.

The PR fixes the two fields to correctly count active and blocked processes:

  • iterate over all processes and their threads to count running ones
  • use perfstat for blocked ones

Still getting processes and threads one at a time for simplicity, it could be improved to reduce the number of calls.

https://www.ibm.com/docs/en/aix/7.1.0?topic=g-getthrds-subroutine
https://www.ibm.com/docs/en/aix/7.3.0?topic=p-perfstat-cpu-total-subroutine
https://www.ibm.com/docs/en/aix/7.3.0?topic=files-libperfstath-file

Copy link
Copy Markdown
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. The fix is well-reasoned and I verified the IBM docs — iowait and physio in perfstat_cpu_total_t are indeed instantaneous snapshot counts (not cumulative), so the approach is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants