V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
wildlynx
V2EX  ›  问与答

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

  •  
  •   wildlynx · Sep 12, 2017 · 2164 views
    This topic created in 3149 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   ·   1061 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:46 · PVG 02:46 · LAX 11:46 · JFK 14:46
    ♥ Do have faith in what you're doing.