Module: OS::Mac::Hardware::CPU::ClassMethods Private
- Extended by:
- T::Helpers
- Defined in:
- extend/os/mac/hardware/cpu.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Instance Method Summary collapse
- #family ⇒ Symbol private
- #features ⇒ Array<Symbol> private
-
#in_rosetta2? ⇒ Boolean
private
True when running under an Intel-based shell via Rosetta 2 on an Apple Silicon Mac.
- #sse4? ⇒ Boolean private
-
#type ⇒ Symbol
private
These methods use info spewed out by sysctl.
Instance Method Details
#family ⇒ Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
28 29 30 31 32 33 34 35 36 |
# File 'extend/os/mac/hardware/cpu.rb', line 28 def family if ::Hardware::CPU.arm? ::Hardware::CPU.arm_family elsif ::Hardware::CPU.intel? ::Hardware::CPU.intel_family else :dunno end end |
#features ⇒ Array<Symbol>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
48 49 50 51 52 53 54 |
# File 'extend/os/mac/hardware/cpu.rb', line 48 def features @features ||= T.let(::Hardware::CPU.sysctl_n( "machdep.cpu.features", "machdep.cpu.extfeatures", "machdep.cpu.leaf7_features", ).split.map { |s| s.downcase.to_sym }, T.nilable(T::Array[Symbol])) end |
#in_rosetta2? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
True when running under an Intel-based shell via Rosetta 2 on an
Apple Silicon Mac. This can be detected via seeing if there's a
conflict between what uname reports and the underlying sysctl flags,
since the sysctl flags don't change behaviour under Rosetta 2.
43 44 45 |
# File 'extend/os/mac/hardware/cpu.rb', line 43 def in_rosetta2? ::Hardware::CPU.sysctl_bool!("sysctl.proc_translated") end |
#sse4? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
57 58 59 |
# File 'extend/os/mac/hardware/cpu.rb', line 57 def sse4? ::Hardware::CPU.sysctl_bool!("hw.optional.sse4_1") end |
#type ⇒ Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
These methods use info spewed out by sysctl.
Look in
16 17 18 19 20 21 22 23 24 25 |
# File 'extend/os/mac/hardware/cpu.rb', line 16 def type case ::Hardware::CPU.sysctl_int("hw.cputype") when MachO::Headers::CPU_TYPE_I386 :intel when MachO::Headers::CPU_TYPE_ARM64 :arm else :dunno end end |