Linux下查询CPU缓存的工具

本文发布时间: 2019-Mar-22
在Linux下可以使用如下工具查询CPU缓存:方式1:$ lscpuL1d cache: 32K <span style="white-space:pre"></span>(一级数据缓存)L1i cache: 32K <span style="white-space:pre"></span><span style="font-family: Arial, Helvetica, sans-serif;">(一级指令缓存)</span>L2 cache: 256K <span style="white-space:pre"></span>(二级缓存)L3 cache: 8192K<span style="white-space:pre"></span>(三级缓存)方式2:$ cat /sys/devices/system/cpu/cpu0/cache/index0/size32K$ cat /sys/devices/system/cpu/cpu0/cache/index0/level1$ cat /sys/devices/system/cpu/cpu0/cache/index1/size32K$ cat /sys/devices/system/cpu/cpu0/cache/index1/level1$ cat /sys/devices/system/cpu/cpu0/cache/index2/size256K$ cat /sys/devices/system/cpu/cpu0/cache/index2/level2$ cat /sys/devices/system/cpu/cpu0/cache/index3/size8192K$ cat /sys/devices/system/cpu/cpu0/cache/index3/level3方式3:$ sudo dmidecode -t cache但是结果与上述的有出路, 显示的L1缓存是256kB, L2缓存是1024 kB, 算上8核, 也与实现不符.可能程序自身有点问题, 不建议用dmidecode.# dmidecode 2.12SMBIOS 2.7 present.Handle 0x003B, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L1Configuration: Enabled, Not Socketed, Level 1Operational Mode: Write BackLocation: InternalInstalled Size: 256 kBMaximum Size: 256 kBHandle 0x003C, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L2Configuration: Enabled, Not Socketed, Level 2Operational Mode: Write BackLocation: InternalInstalled Size: 1024 kBMaximum Size: 1024 kBHandle 0x003D, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L3Configuration: Enabled, Not Socketed, Level 3Operational Mode: Write BackLocation: InternalInstalled Size: 8192 kBMaximum Size: 8192 kB方式4:$ cat /proc/cpuinfo cache size: 8192 KB这个只是显示出 L3 cache的大小, 也并不准确.


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表