Module: Hardware

Extended by:
T::Sig
Defined in:
extend/os/mac/hardware.rb,
extend/os/mac/hardware/cpu.rb,
extend/os/linux/hardware/cpu.rb,
hardware.rb

Overview

Helper module for querying hardware information.

Defined Under Namespace

Classes: CPU

Class Method Summary collapse

Class Method Details

.cores_as_wordsObject



185
186
187
188
189
190
191
192
193
194
195
196
# File 'hardware.rb', line 185

def cores_as_words
  case Hardware::CPU.cores
  when 1 then "single"
  when 2 then "dual"
  when 4 then "quad"
  when 6 then "hexa"
  when 8 then "octa"
  when 12 then "dodeca"
  else
    Hardware::CPU.cores
  end
end

.oldest_cpu(_version = nil) ⇒ Symbol Also known as: generic_oldest_cpu

Parameters:

Returns:



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'extend/os/mac/hardware.rb', line 7

def self.oldest_cpu(version = MacOS.version)
  if CPU.arch == :arm64
    :arm_vortex_tempest
  # TODO: this cannot be re-enabled until either Rosetta 2 supports AVX
  # instructions in bottles or Homebrew refuses to run under Rosetta 2 (when
  # ARM support is sufficiently complete):
  #   https://github.com/Homebrew/homebrew-core/issues/67713
  #
  # elsif version >= :big_sur
  #   :ivybridge
  elsif version >= :mojave
    :nehalem
  else
    generic_oldest_cpu
  end
end