Sha256: 937c3d7ce113282facdb7f08b2ddf8c4fa39c585bc31c2ab5c7057d3cd6d930d

Contents?: true

Size: 484 Bytes

Versions: 12

Compression:

Stored size: 484 Bytes

Contents

module Pione
  module Util
    # CPU is a name space for CPU related functions.
    module CPU
      # Return CPU core number in this machine. This method tries to find it by
      # using sys-cpu gem, but return 1 if something bad.
      #
      # @return [Integer]
      #    CPU core nunmber
      def core_number
        begin
          [Sys::CPU.processors.size, 1].max
        rescue Object
          1
        end
      end
      module_function :core_number
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pione-0.5.0 lib/pione/util/cpu.rb
pione-0.5.0.alpha.2 lib/pione/util/cpu.rb
pione-0.5.0.alpha.1 lib/pione/util/cpu.rb
pione-0.4.2 lib/pione/util/cpu.rb
pione-0.4.1 lib/pione/util/cpu.rb
pione-0.4.0 lib/pione/util/cpu.rb
pione-0.3.2 lib/pione/util/cpu.rb
pione-0.3.1 lib/pione/util/cpu.rb
pione-0.3.0 lib/pione/util/cpu.rb
pione-0.2.2 lib/pione/util/cpu.rb
pione-0.2.1 lib/pione/util/cpu.rb
pione-0.2.0 lib/pione/util/cpu.rb