class Facter::Processors::SunOS

Public Class Methods

new() click to toggle source
# File lib/facter/processors/os.rb, line 193
def initialize
  kernelrelease = Facter.value(:kernelrelease)
  @major_version = kernelrelease.split(".")[0].to_i
  @minor_version = kernelrelease.split(".")[1].to_i
end

Public Instance Methods

get_physical_processor_count() click to toggle source
# File lib/facter/processors/os.rb, line 215
def get_physical_processor_count
  if @major_version > 5 or (@major_version == 5 and @minor_version >= 8)
    if output = Facter::Core::Execution.exec("/usr/sbin/psrinfo -p")
      output.to_i
    end
  else
    count_cpu_with_psrinfo
  end
end
get_processor_count() click to toggle source
# File lib/facter/processors/os.rb, line 203
def get_processor_count
  if @major_version < 5 or (@major_version == 5 and @minor_version < 8)
    if count = count_cpu_with_kstat
      count
    else
      count_cpu_with_psrinfo
    end
  else
    count_cpu_with_psrinfo
  end
end
get_processor_list() click to toggle source
# File lib/facter/processors/os.rb, line 199
def get_processor_list
  Facter::Util::Processor.enum_kstat
end

Private Instance Methods

count_cpu_with_kstat() click to toggle source
# File lib/facter/processors/os.rb, line 227
def count_cpu_with_kstat
  if output = Facter::Core::Execution.exec("/usr/bin/kstat cpu_info")
    output.scan(/\bcore_id\b\s+\d+/).uniq.length
  else
    nil
  end
end
count_cpu_with_psrinfo() click to toggle source
# File lib/facter/processors/os.rb, line 235
def count_cpu_with_psrinfo
  if output = Facter::Core::Execution.exec("/usr/sbin/psrinfo")
    output.split("\n").length
  else
    nil
  end
end