How to measure mispredictions for a single branch on Linux?

后端 未结 1 1814
孤独总比滥情好
孤独总比滥情好 2021-02-10 05:04

I know that I can get the total percentage of branch mispredictions during the execution of a program with perf stat. But how can I get the statistics for a specifi

1条回答
  •  星月不相逢
    2021-02-10 05:21

    You can sample on the branch-misses event:

    sudo perf record -e branch-misses

    and then report it (and even selecting the function you're interested in):

    sudo perf report -n --symbols=

    There you can access the annotated code and get some statistics for a given branch. Or directly annotate it with the perf command with --symbol option.

    0 讨论(0)
提交回复
热议问题