class MacSystemProcessors

Processor probe for Mac systems noinspection RubyTooManyInstanceVariablesInspection

Public Class Methods

new() click to toggle source
# File lib/processors.rb, line 60
def initialize
  # noinspection RubyResolve
  proc = sysctl(HardwareCategory::PROCESSORS)
  @model = proc['model']
  @speed = proc['cpufrequency'].to_i / 1_000_000
  @family = proc['family']
  @architecture = 'x86_64' if proc['cpu64bit_capable'] == '1'
  @count = `system_profiler SPHardwareDataType | grep Processors: | sed -e 's/ *Number of Processors: //'`.to_i
  @core_count = proc['core_count'].to_i * @count
  @thread_count = proc['thread_count'].to_i * @count
  @l2_cache = `system_profiler SPHardwareDataType | grep 'L2 Cache' | sed -e 's/ *L2 Cache (per Core): //'`
  @l2_cache = @l2_cache.to_i * @core_count
  @l3_cache = `system_profiler SPHardwareDataType | grep 'L3 Cache' | sed -e 's/ *L3 Cache: //'`.to_i * 1024
  @manufacturer = proc['vendor']
  @model_name = proc['brand_string']
end