因為論文需要CPU cache的相關資訊,但intel官方網站上http://ark.intel.com/#desktopprocessors只能查到L2 cache的大小。於是從網路上找到了linux系統下查看Cache大小的兩種方法。
第一種方法就是從開機資訊中尋找:
[root@c0106 papi]# dmesg |grep cacheDentry cache hash table entries: 524288 (order: 10, 4194304 bytes)Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)Mount-cache hash table entries: 256CPU: L1 I cache: 32K, L1 D cache: 32KCPU: L2 cache: 4096KCPU: L1 I cache: 32K, L1 D cache: 32KCPU: L2 cache: 4096KCPU: L1 I cache: 32K, L1 D cache: 32KCPU: L2 cache: 4096KCPU: L1 I cache: 32K, L1 D cache: 32KCPU: L2 cache: 4096KIP 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.7SCSI device sda: drive cache: write backSCSI device sda: drive cache: write backsdb: assuming drive cache: write throughsdb: assuming drive cache: write throughsdc: assuming drive cache: write throughsdc: assuming drive cache: write through
第二種方法:
[root@c0106 papi]# ls /sys/devices/system/cpu/cpucpu0/ 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/typeData[root@c0106 papi]# cat /sys/devices/system/cpu/cpu0/cache/index0/size32K
從上面可以看出,這裡顯示的為一級資料cache的資訊。二級Cache的相關資訊在ndex1 index2 目錄下