首页 > Linux操作系统 > Linux操作系统 > 检查LINUX环境的CPU缓存
记录一下LINUX如何检查CPU的缓存情况。
平常经常使用/proc/cpuinfo来检查cpu的情况,不过最近发现这种情况的检查结果不准确。
更加详细的情况应该通过/var/log/dmesg来获得。
[root@BJdata1 ~]# more /proc/cpuinfo|grep cache
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
cache size : 4096 KB
cache_alignment : 64
这里看到的CACHE SIZE是L2缓存的值,不过对于操作系统无法认出L2缓存的情况,这里就显示出L1的值:
[root@haoc2008 ~]# more /proc/cpuinfo |grep cache
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
cache size : 64 KB
cache_alignment : 64
而详细的情况应该通过dmesg获得:
[root@BJdata1 ~]# more /var/log/dmesg |grep cache
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
Mount-cache hash table entries: 256
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 4096K
IP route cache hash table entries: 262144 (order: 9, 2097152 bytes)
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
PCI: cache line size of 32 is not supported by device 0000:00:1d.7
SCSI device sda: drive cache: write back
SCSI device sda: drive cache: write back
SCSI device sdb: drive cache: write back
SCSI device sdb: drive cache: write back
最后提一句,感谢网友rain的提醒,才发现REDHAT早期版本对DELL的新CPU支持不好,导致CPU的L2缓冲没有被认出来。这就是上面第二个/proc/cpuinfo查询出来的结果。
看来以后安装完系统,还要留意一下系统对硬件的支持情况。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-69551/,如需转载,请注明出处,否则将追究法律责任。