linux 怎么看自己cache info

linux 怎么看自己cache info

到如下:

root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache# pwd
/sys/devices/system/cpu/cpu0/cache
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache# ls -a
.  ..  index0  index1  index2  index3  power  uevent

依次解读一下如下信息:

root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat type
Data
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat level 
1
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat ways_of_associativity 
8
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat shared_cpu_map 
00000000,00000001
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat size 
32K
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat number_of_sets 
64
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat coherency_line_size 
64
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat uevent 
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index0# cat physical_line_partition 
1

其实看上面的输出,大概也能猜出来其中含义,index0/type表明这是一个数据缓存,level是1,就是L1$date,8路相连,sets数目是每路64,所以64*64*8=32*1024=32kb就是这么来的。
在看一个index1

root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index1# cat size 
32K
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index1# cat ways_of_associativity 
8
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index1# cat level 
1

L1$I指令缓存

index2

root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index2# cat number_of_sets 
1024
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index2# cat level 
2
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index2# cat coherency_line_size 
64
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index2# cat size 
256K

上面自行解读。L2缓存。

重点看一下L3

root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index3# cat ways_of_associativity 
12
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index3# cat  number_of_sets 
8192
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index3# cat coherency_line_size 
64
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index3# cat level 
3
root@zhangji16vm:/sys/devices/system/cpu/cpu0/cache/index3# cat size 
6144K

需要注意的是,L3尽管是多核共享的,但是上面提到的任然是单个处理器的参数。因为多核之间会通过Bus-Brige连接,上面的6M表示总共L3缓存大小,几个核累加的大小就是6M。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值