Sha256: 8c6daee7d6453f7445737fee65c64796083915c0841e44c6e88b7818790bc56f

Contents?: true

Size: 321 Bytes

Versions: 104

Compression:

Stored size: 321 Bytes

Contents

require 'etc'

module Switchman
  class Environment

    def self.cpu_count(nproc_bin = "nproc")
      if Etc.respond_to?(:nprocessors)
        return Etc.nprocessors
      end

      return `#{nproc_bin}`.to_i
    rescue Errno::ENOENT
      # an environment where nproc` isnt available
      return 0
    end

  end
end

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
switchman-2.0.1 lib/switchman/environment.rb
switchman-2.0.0 lib/switchman/environment.rb
switchman-1.16.0 lib/switchman/environment.rb
switchman-1.15.2 lib/switchman/environment.rb
switchman-1.15.1 lib/switchman/environment.rb
switchman-1.15.0 lib/switchman/environment.rb
switchman-1.14.10 lib/switchman/environment.rb
switchman-1.14.9 lib/switchman/environment.rb
switchman-1.14.8 lib/switchman/environment.rb
switchman-1.14.7 lib/switchman/environment.rb
switchman-1.14.6 lib/switchman/environment.rb
switchman-1.14.5 lib/switchman/environment.rb
switchman-1.14.4 lib/switchman/environment.rb
switchman-1.14.3 lib/switchman/environment.rb
switchman-1.14.2 lib/switchman/environment.rb
switchman-1.14.1 lib/switchman/environment.rb
switchman-1.14.0 lib/switchman/environment.rb
switchman-1.13.3 lib/switchman/environment.rb
switchman-1.13.2 lib/switchman/environment.rb
switchman-1.13.1 lib/switchman/environment.rb