如何得到 CPU 的 BTB ( Branch Target Buffers)大小 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
wildlynx

如何得到 CPU 的 BTB ( Branch Target Buffers)大小

  •  
  •   wildlynx Sep 12, 2017 2172 views
    This topic created in 3151 days ago, the information mentioned may be changed or developed.
    https://www.ibm.com/developerworks/cn/linux/l-cn-perf1/index.html

    在看 perf 性能调优工具的一篇看到这样的话:

    “可以看到 branche-misses 的情况比较严重,25% 左右。我测试使用的机器的处理器为 Pentium4,其 BTB 的大小为 16。而 test.c 中的循环迭代为 20 次,BTB 溢出,所以处理器的分支预测将不准确。”
    3 replies    2017-09-12 13:53:00 +08:00
    Mithril
        1
    Mithril  
       Sep 12, 2017
    没地方能知道。分支预测算是核心技术了,文档里面基本也没有太详细的描述。
    这篇文章的作者在这个例子上是直接翻译的参考文章 6,那篇文章是 Intel 的人自己写的。而且是在 2011 年写的 P4 中的实现。
    不过你可以照着文章的实现代码写个程序试试看大概有多大。如果你的处理器用的是 BTB 的话
    coderluan
        2
    coderluan  
       Sep 12, 2017
    google:vtune amplifier BTB

    @Mithril #1 可以做到,当然这种核心技术 Intel 自己有提供,上面提供的工具就是 Intel parallel studio 的一个组件。
    Mithril
        3
    Mithril  
       Sep 12, 2017
    @coderluan 题主想要的是 BTB 的 size,而不是分支预测失败的性能计数
    About     Help     Advertise     Blog     API     FAQ     Solana     3967 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 35ms UTC 10:18 PVG 18:18 LAX 03:18 JFK 06:18
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86