在 CentOS 系统中,可以通过以下几种方法查看 CPU 的 L2 缓存信息:
lscpu 命令lscpu
L2 Cache 相关的信息。通常,你会在 Cache 部分看到 L2 缓存的详细信息。/proc/cpuinfo 文件cat /proc/cpuinfo
cache size 字段。L2 缓存的大小通常会在这个字段中显示。dmidecode 命令sudo dmidecode -t processor
L2 Cache Size 字段。这里会显示每个 CPU 核心的 L2 缓存大小。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: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Stepping: 9
CPU MHz: 2400.000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 2048K
dmidecode 命令的输出示例:Handle 0x001E, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU1
Type: Central Processor
Family: Core i7
Manufacturer: Intel Corporation
ID: AEBF0695 00000000 FFBAEBFF BFFFBBFB
Version: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Voltage: 1.2 V
External Clock: 100 MHz
Max Speed: 3800 MHz
Current Speed: 2800 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x001F
Size: 32 KB
Type: Data
Configuration: Enabled, Exclusive
Location: Other
L2 Cache Handle: 0x0020
Size: 256 KB
Type: Data, Instruction
Configuration: Enabled, Exclusive
Location: Other
L3 Cache Handle: 0x0021
Size: 2048 KB
Type: Data, Instruction
Configuration: Enabled, Shared
Location: Other
通过这些方法,你可以轻松地查看 CentOS 系统中 CPU 的 L2 缓存信息。