转载自:http://blog.csdn.net/zhuliting/article/details/6744090
因为论文需要CPU cache的相关信息,但intel官方网站上http://ark.intel.com/#desktopprocessors只能查到L2 cache的大小。于是从网络上找到了linux系统下查看Cache大小的两种方法。
第一种方法就是从开机信息中查找:
- [root@c0106 papi]# dmesg |grep cache
- Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes)
- Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)
- Mount-cache hash table entries: 256
- CPU: L1 I cache: 32K, L1 D cache: 32K
- CPU: L2 cache: 4096K
- CPU: L1 I cache: 32K, L1 D cache: 32K
- CPU: L2 cache: 4096K
- CPU: L1 I cache: 32K, L1 D cache: 32K
- CPU: L2 cache: 4096K
- CPU: L1 I cache: 32K, L1 D cache: 32K
- CPU: L2 cache: 4096K
- IP route cache hash table entries: 131072 (order: 8, 1048576 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
- sdb: assuming drive cache: write through
- sdb: assuming drive cache: write through
- sdc: assuming drive cache: write through
- sdc: assuming drive cache: write through
第二种方法:
- [root@c0106 papi]# ls /sys/devices/system/cpu/cpu
- cpu0/ cpu1/ cpu2/ cpu3/
本机为深腾1800的一个子节点,双核,启用超线程技术,所以这里显示了四个CPU。
- [root@c0106 papi]# ls /sys/devices/system/cpu/cpu0/cache/
- index0 index1 index2
- [root@c0106 papi]# cat /sys/devices/system/cpu/cpu0/cache/index0/level
- 1
- [root@c0106 papi]# cat /sys/devices/system/cpu/cpu0/cache/index0/type
- Data
- [root@c0106 papi]# cat /sys/devices/system/cpu/cpu0/cache/index0/size
- 32K
从上面可以看出,这里显示的为一级数据cache的信息。二级Cache的相关信息在 ndex1 index2 目录下