Class: Henitai::AvailableCpuCount
- Inherits:
-
Object
- Object
- Henitai::AvailableCpuCount
- Defined in:
- lib/henitai/available_cpu_count.rb
Overview
Detects the effective CPU count available to the current process.
Constant Summary collapse
- CFS_QUOTA_PATH =
"/sys/fs/cgroup/cpu/cpu.cfs_quota_us"- CFS_PERIOD_PATH =
"/sys/fs/cgroup/cpu/cpu.cfs_period_us"
Class Method Summary collapse
Class Method Details
.detect ⇒ Object
12 13 14 15 |
# File 'lib/henitai/available_cpu_count.rb', line 12 def detect counts = [Etc.nprocessors, cgroup_cpu_quota, cpuset_cpu_count].compact.select(&:positive?) counts.min || 1 end |