class Facter::Processors::Darwin

Public Class Methods

new() click to toggle source
# File lib/facter/processors/os.rb, line 146
def initialize
  require "cfpropertylist"
  @system_hardware_data = query_system_profiler
end

Public Instance Methods

get_processor_count() click to toggle source
# File lib/facter/processors/os.rb, line 151
def get_processor_count
  Facter::Util::POSIX.sysctl("hw.ncpu").to_i
end
get_processor_speed() click to toggle source
# File lib/facter/processors/os.rb, line 155
def get_processor_speed
  @system_hardware_data["current_processor_speed"]
end

Private Instance Methods

query_system_profiler() click to toggle source
# File lib/facter/processors/os.rb, line 161
def query_system_profiler
  output = Facter::Core::Execution.exec("/usr/sbin/system_profiler -xml SPHardwareDataType 2>/dev/null")
  plist  = CFPropertyList::List.new
  plist.load_str(output)
  parsed_xml = CFPropertyList.native_types(plist.value)
  parsed_xml[0]['_items'][0]
end