在 Linux 系统中,有多种方法可以查看 CPU 的相关信息,以下是一些常用的方法:
使用 cat /proc/cpuinfo 命令:
cat /proc/cpuinfo
输出示例:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
stepping : 10
microcode : 0xdec
cpu MHz : 1954.708
cache size : 8192 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
使用 lscpu 命令:
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: 142
Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Stepping: 10
CPU MHz: 1954.708
BogoMIPS: 5424.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
top、mpstat、vmstat 等,可以实时监控系统 CPU 的使用情况,帮助发现性能瓶颈。通过上述方法,你可以全面了解 CPU 的性能和配置,从而做出相应的优化决策。