Class: Henitai::AvailableCpuCount

Inherits:
Object
  • Object
show all
Defined in:
lib/henitai/available_cpu_count.rb

Overview

Detects the effective CPU count available to the current process.

Class Method Summary collapse

Class Method Details

.detectObject



9
10
11
12
# File 'lib/henitai/available_cpu_count.rb', line 9

def detect
  counts = [Etc.nprocessors, cgroup_cpu_quota, cpuset_cpu_count].compact.select(&:positive?)
  counts.min || 1
end