Sha256: 042c66c614650ad42c4b35b76de07bd3ea2ab03943473284360121c777431d5a

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

# Fact: physicalprocessorcount
#
# Purpose: Return the number of physical processors.
#
# Resolution:
#   Uses the physicalprocessorcount key of the processors structured
#   fact, which itself attempts to use sysfs to get the physical IDs of
#   the processors and falls back to `/proc/cpuinfo` and `physical id` if
#   sysfs is not available.
#
# Caveats:
#

Facter.add('physicalprocessorcount') do
  confine do
    !Facter.value(:processors).nil?
  end

  setcode do
    processors = Facter.value(:processors)
    if (physicalprocessorcount = processors["physicalcount"])
      physicalprocessorcount.to_s
    else
      nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facter-2.2.0 lib/facter/physicalprocessorcount.rb
facter-2.2.0-x86-mingw32 lib/facter/physicalprocessorcount.rb
facter-2.2.0-x64-mingw32 lib/facter/physicalprocessorcount.rb
facter-2.2.0-universal-darwin lib/facter/physicalprocessorcount.rb