Method: Concurrent.processor_count
- Defined in:
- lib/concurrent-ruby/concurrent/utility/processor_counter.rb
.processor_count ⇒ Integer
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.
When running under JRuby the Java runtime call ‘java.lang.Runtime.getRuntime.availableProcessors` will be used. According to the Java documentation this “value may change during a particular invocation of the virtual machine… [applications] should therefore occasionally poll this property.” We still memoize this value once under JRuby.
Otherwise Ruby’s Etc.nprocessors will be used.
160 161 162 |
# File 'lib/concurrent-ruby/concurrent/utility/processor_counter.rb', line 160 def self.processor_count processor_counter.processor_count end |