Skip to content

Add processor count and quota APIs - #13

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
processor-count-and-quota
Sep 4, 2026
Merged

Add processor count and quota APIs#13
samuel-williams-shopify merged 1 commit into
mainfrom
processor-count-and-quota

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

  • add Process::Metrics::Processor.count as an affinity-aware integer processor count backed by Etc.nprocessors
  • add Process::Metrics::Processor.quota as a floating-point capacity that accounts for cgroup v2 cpu.max limits
  • inspect parent cgroups for inherited limits, cap quota at the available processor count, and fall back to the count when no finite quota is available
  • document the APIs and add platform-independent and Linux-specific tests

Cgroup v1 is intentionally not supported; those systems use the safe processor-count fallback.

Testing

  • bundle exec bake test
  • bundle exec rubocop
  • bundle exec bake decode:index:coverage lib
  • forced Linux backend tests on macOS via RUBYOPT

@samuel-williams-shopify
samuel-williams-shopify force-pushed the processor-count-and-quota branch 2 times, most recently from f98c43a to 5f80ee7 Compare September 4, 2026 09:16
Signed-off-by: Samuel Williams <samuel.williams@shopify.com>
Assisted-By: devx/874cdf9e-3541-4d85-9ae8-b4ebb7e4db80
@samuel-williams-shopify
samuel-williams-shopify merged commit b04d7de into main Sep 4, 2026
34 of 39 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the processor-count-and-quota branch September 4, 2026 09:19
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