summaryrefslogtreecommitdiffstats
path: root/lib/facter/physicalprocessorcount.rb
blob: 9c59614bf9d7688e0246af67f539774206950656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Fact: physicalprocessorcount
#
# Purpose: Return the number of physical processors.
#
# Resolution:
#   On linux, parses the output of '/proc/cpuinfo' for the number of unique
#   lines with "physical id" in them.
#
# Caveats:
#

Facter.add("physicalprocessorcount") do
    confine :kernel => :linux

    setcode do
        ppcount = Facter::Util::Resolution.exec('grep "physical id" /proc/cpuinfo|cut -d: -f 2|sort -u|wc -l')
    end
end