如何获取我的计算机中硬件级线程的数量?

如何获取我的计算机中硬件级线程的数量?

如何使用 ubuntu 终端获取我的计算机中的硬件级线程数?

答案1

使用lscpu

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 69
Stepping:              1
CPU MHz:               806.347
BogoMIPS:              4988.30
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3

操作系统将每个硬件线程识别为不同的 CPU。您想要的数字显示在行,这与将和相乘CPU(s):相同Thread(s) per core:Core(s) per socket:Socket(s):

或者您可以使用单个命令:

lscpu -p | grep -c "^[0-9]"

相关内容