Class: LinuxSystemProcessors

Inherits:
SystemProcessors show all
Defined in:
lib/processors.rb

Overview

Processor probe for Linux systems noinspection RubyTooManyInstanceVariablesInspection

Constant Summary

Constants inherited from SystemProcessors

SystemProcessors::UNLIMITED

Instance Attribute Summary

Attributes inherited from SystemProcessors

#architecture, #core_count, #count, #family, #l2_cache, #l3_cache, #manufacturer, #model, #model_name, #speed, #thread_count

Instance Method Summary collapse

Methods inherited from SystemProcessors

probe

Constructor Details

#initializeLinuxSystemProcessors

Returns a new instance of LinuxSystemProcessors.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/processors.rb', line 39

def initialize
  proc = lscpu
  @model = proc['Model']
  @model_name = proc['Model name']
  @speed = (@model_name.split[5][0..-4].to_f * 1000).to_i
  @family = proc['CPU family']
  @architecture = proc['Architecture']
  @count = proc['Socket(s)'].to_i
  @core_count = proc['Core(s) per socket'].to_i * @count
  @thread_count = proc['Thread(s) per core'].to_i * @core_count
  @l2_cache = proc['L2 cache'][0..-2].to_i * @core_count
  @l3_cache = proc['L3 cache'][0..-2].to_i
  @manufacturer = proc['Vendor ID']
end