在Linux系统中,有多种方法可以查看CPU信息,以下是其中两种常用的方法:
cat /proc/cpuinfo
命令查看CPU信息cat /proc/cpuinfo
,然后按回车键。示例输出:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
stepping : 4
microcode : 0x200005ac
cpu MHz : 2100.000
cache size : 22528 KB
physical id : 1
siblings : 32
core id : 1
cpu cores : 16
apicid : 57
initial apicid : 57
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm arat pln pts pku ospkebugs : bogomips : 4206.91
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
cpuinfo
查看CPU信息cpuinfo
库:pip install py-cpuinfo
from cpuinfo import get_cpu_info
info = get_cpu_info()
print("CPU型号:", info['brand_raw'])
print("CPU核心数:", info['count'])
print("CPU实际频率:", info['hz_actual'])
print("CPU架构信息:", info['arch'])
print("CPU的指令集:", info['flags'])
print("CPU缓存大小(L2):", info['l2_cache_size'])
以上就是Linux系统中查看CPU信息的两种常用方法。使用cat /proc/cpuinfo
命令可以查看基本的CPU信息,而使用Python库 cpuinfo
则可以更方便地获取详细的CPU信息,并且该库支持跨平台使用。