Class: Facter::Processors::Windows

Inherits:
Base
  • Object
show all
Defined in:
lib/facter/processors/os.rb

Instance Method Summary collapse

Methods inherited from Base

#get_processor_count, #get_processor_speed

Constructor Details

#initializeWindows

Returns a new instance of Windows.



106
107
108
# File 'lib/facter/processors/os.rb', line 106

def initialize
  require 'facter/util/wmi'
end

Instance Method Details

#get_physical_processor_countObject



128
129
130
# File 'lib/facter/processors/os.rb', line 128

def get_physical_processor_count
   Facter::Util::WMI.execquery("select Name from Win32_Processor").Count
end

#get_processor_listObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/facter/processors/os.rb', line 110

def get_processor_list
  processor_list = []
  # get each physical processor
  Facter::Util::WMI.execquery("select * from Win32_Processor").each do |proc|
    # not supported before 2008
    if proc.respond_to?(:NumberOfLogicalProcessors)
      processor_num = proc.NumberOfLogicalProcessors
    else
      processor_num = 1
    end

    processor_num.times do |i|
      processor_list << proc.Name.squeeze(" ")
    end
  end
  processor_list
end