Mac gets cpu information

  macos

cpu core

  • Physical CPU
    Number of CPUs on Slots in Actual Server

The number of physical cpu can be counted as the number of non-repeating physical id

  • Logical CPU
    In general, we think that a cpu can have multiple cores, and with intel’s Hyper-Threading Technology (HT), it can logically split the number of cpu core by a factor of two.

Logical cpu Count = Physical CPU Count x cpu cores This specification value x 2 (if ht is supported and turned on)
Note: the number of CPUs viewed by top under Linux is also the number of logical CPUs

  • CPU cores
    The number of chipsets capable of processing data on a CPU, such as the current i5 760, is a dual-core four-thread CPU, while i5250 is a four-core four-thread CPU.

In general, the number of physical CPUs × the number of cores per core should be equal to the number of logical CPUs, if not equal, then the server’s CPU supports hyper-threading technology

sysctl hw

sysctl hw.physicalcpu
sysctl hw.logicalcpu

Separate output

hw.physicalcpu: 2
hw.logicalcpu: 4

system_profiler SPHardwareDataType

Hardware:

    Hardware Overview:

      Model Name: MacBook Air
      Model Identifier: MacBookAir7,2
      Processor Name: Intel Core i7
      Processor Speed: 2.2 GHz
      Number of Processors: 1
      Total Number of Cores: 2
      L2 Cache (per Core): 256 KB
      L3 Cache: 4 MB
      Memory: 8 GB
      Boot ROM Version: xxxxxxx
      SMC Version (system): 2.27f2
      Serial Number (system): xxxxxxx
      Hardware UUID: xxxxxxxxxxxxxxx

doc