Class: Garcon::ProcessorCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/garcon/task/processor_count.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessorCounter

Returns a new instance of ProcessorCounter.



26
27
28
29
# File 'lib/garcon/task/processor_count.rb', line 26

def initialize
  @processor_count          = Delay.new { compute_processor_count }
  @physical_processor_count = Delay.new { compute_physical_count }
end

Instance Method Details

#physical_processor_countObject

Number of physical processor cores on the current system. For performance reasons the calculated value will be memoized on the first call.



42
43
44
# File 'lib/garcon/task/processor_count.rb', line 42

def physical_processor_count
  @physical_processor_count.value
end

#processor_countObject

Number of processors seen by the OS and used for process scheduling. For performance reasons the calculated value will be memoized on the first call.



35
36
37
# File 'lib/garcon/task/processor_count.rb', line 35

def processor_count
  @processor_count.value
end