參考資料
https://blog.csdn.net/zklth/article/details/6280046
https://blog.csdn.net/wofreeo/article/details/90518609
getconf -a | grep CACHE
ls -l /sys/devices/system/cpu/cpu0/cache/index
index0/ index1/ index2/
index0和Index1是一級cache中的data和instruction cache
ls -l /sys/devices/system/cpu/cpu0/cache/index0/
level:cache等級 L1/L2/L3
type:cache類型, (Data Cache,D-Cache)和一級指令緩存(Instruction Cache,I-Cache)
size: cache大小
一級緩存可以分為一級數據緩存(Data Cache,D-Cache)和一級指令緩存(Instruction Cache,I-Cache)。
二者分別用來存放數據以及對執行這些數據的指令進行即時解碼,而且兩者可以同時被CPU訪問,減少了爭用Cache所造成的沖突,提高了處理器效能。目前大多數CPU的一級數據緩存和一級指令緩存具有相同的容量,例如AMD的Athlon XP就具有64KB的一級數據緩存和64KB的一級指令緩存,其一級緩存就以64KB 64KB來表示,其余的CPU的一級緩存表示方法以此類推。
一級cache, Data cache
cat /sys/devices/system/cpu/cpu0/cache/index0/level
cat /sys/devices/system/cpu/cpu0/cache/index0/type
cat /sys/devices/system/cpu/cpu0/cache/index0/size
一級cache, Instruction cache
cat /sys/devices/system/cpu/cpu0/cache/index1/level
cat /sys/devices/system/cpu/cpu0/cache/index1/type
cat /sys/devices/system/cpu/cpu0/cache/index1/size
二級cache
cat /sys/devices/system/cpu/cpu0/cache/index2/level
cat /sys/devices/system/cpu/cpu0/cache/index2/type
cat /sys/devices/system/cpu/cpu0/cache/index2/size