Class: LinuxSystemProcessors
- Inherits:
-
SystemProcessors
- Object
- SystemProcessors
- LinuxSystemProcessors
- Defined in:
- lib/processors.rb
Overview
Processor probe for Linux systems noinspection RubyTooManyInstanceVariablesInspection
Constant Summary
Constants inherited from SystemProcessors
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
-
#initialize ⇒ LinuxSystemProcessors
constructor
A new instance of LinuxSystemProcessors.
Methods inherited from SystemProcessors
Constructor Details
#initialize ⇒ LinuxSystemProcessors
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 |