部分文章内容为公开资料查询整理,原文出处可能未标注,如有侵权,请联系我,谢谢。邮箱地址:gnivor@163.com ►►►需要气球么?请点击我吧!

linux笔记-查看L1/L2/L3 cache/cacheline大小

参考资料

https://blog.csdn.net/zklth/article/details/6280046
https://blog.csdn.net/wofreeo/article/details/90518609

查看cache size

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

查看cacheline大小

cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size
cat /sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size
cat /sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size
cat /sys/devices/system/cpu/cpu0/cache/index3/coherency_line_size

本机看都是64

posted @ 2021-09-01 15:45  流了个火  阅读(4905)  评论(0编辑  收藏  举报
►►►需要气球么?请点击我吧!►►►
View My Stats