Class: Facter::Processors::Windows
- Defined in:
- lib/facter/processors/os.rb
Instance Method Summary collapse
- #get_physical_processor_count ⇒ Object
- #get_processor_list ⇒ Object
-
#initialize ⇒ Windows
constructor
A new instance of Windows.
Methods inherited from Base
#get_processor_count, #get_processor_speed
Constructor Details
#initialize ⇒ Windows
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_count ⇒ Object
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_list ⇒ Object
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 |