Class: Garcon::ProcessorCounter
- Defined in:
- lib/garcon/task/processor_count.rb
Instance Method Summary collapse
-
#initialize ⇒ ProcessorCounter
constructor
A new instance of ProcessorCounter.
-
#physical_processor_count ⇒ Object
Number of physical processor cores on the current system.
-
#processor_count ⇒ Object
Number of processors seen by the OS and used for process scheduling.
Constructor Details
#initialize ⇒ ProcessorCounter
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_count ⇒ Object
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_count ⇒ Object
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 |