命令大全-linux

119 阅读3分钟

cpu相关

cpu信息查看

cpu信息查看命令 lscpu

以下是运行 lscpu 命令后典型的输出示例和字段解释:

$ lscpu

输出示例:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           158
Model name:                      Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Stepping:                        10
CPU MHz:                         800.045
CPU max MHz:                     4600.0000
CPU min MHz:                     800.0000
BogoMIPS:                        6399.99
Virtualization:                  VT-x
L1d cache:                       32K
L1i cache:                       32K
L2 cache:                        256K
L3 cache:                        12M
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     Mitigation; KVM: VMX disabled
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Mitigation; TSX disabled
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
                                 mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc
                                 arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni
                                 pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm
                                 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c
                                 rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb
                                 stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep
                                 bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt clwb intel_pt xsaveopt xsavec
                                 xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
                                 md_clear flush_l1d arch_capabilities
字段详细解释
基本信息
  • Architecture: CPU架构,比如 x86_64 表示 64 位架构。
  • CPU op-mode(s) : 支持的操作模式,比如 32-bit, 64-bit
  • Byte Order: 字节序,比如 Little Endian 表示小端序。
核心和线程信息
  • CPU(s) : 逻辑CPU的总数(核心数 × 每核心线程数)。
  • On-line CPU(s) list: 当前在线的逻辑CPU编号。
  • Thread(s) per core: 每个核心支持的线程数(如超线程技术)。
  • Core(s) per socket: 每个物理CPU插槽的核心数。
  • Socket(s) : 物理CPU插槽数量。
  • NUMA node(s) : NUMA节点的数量。
频率信息
  • CPU MHz: 当前CPU的运行频率(动态频率,随负载波动)。
  • CPU max MHz: CPU的最大频率。
  • CPU min MHz: CPU的最小频率。
  • BogoMIPS: 理论上的CPU性能指标,用于内核调度。
CPU型号信息
  • Vendor ID: CPU厂商,比如 GenuineIntelAuthenticAMD
  • CPU family: CPU家族号。
  • Model: CPU型号编号。
  • Model name: CPU的具体型号。
  • Stepping: 微架构修订版本。
缓存信息
  • L1d cache: 一级数据缓存大小。
  • L1i cache: 一级指令缓存大小。
  • L2 cache: 二级缓存大小。
  • L3 cache: 三级缓存大小。
虚拟化和扩展特性
  • Virtualization: 是否支持虚拟化,比如 VT-xAMD-V
  • Flags: CPU支持的特性,比如 fpu, mmx, sse, avx 等。
安全性和漏洞缓解
  • Vulnerability: 列出CPU已知的漏洞及其缓解措施,比如 Spectre、Meltdown 等。

如何使用此信息?
  • 系统调优:查看核心数和线程数,用于配置多线程应用或虚拟机。
  • 性能分析:检查频率范围和缓存大小,评估硬件性能。
  • 安全评估:检查漏洞缓解措施,确保系统安全。
  • 兼容性:查看CPU指令集和扩展特性,判断是否支持特定应用。