For measuring the branch prediction and the branch misprediction rate you can use the VTune Profiler.
Download link:
https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html#gs.bh5zrq
Just create custom VTune analysis with 2 events:
BR_INST_RETIRED.ALL_BRANCHES
BR_MISP_RETIRED.ALL_BRANCHES
You'll need to manually divide one by another to get the ration though.
BR_INST_RETIRED.ALL_BRANCHES
Counts all (macro) branch instructions retired.
BR_MISP_RETIRED.ALL_BRANCHES
Counts all the retired branch instructions that were miss predicted by the processor.
A branch misprediction occurs when the processor incorrectly predicts the destination of the branch.
When the misprediction is discovered at execution, all the instructions executed in the wrong (speculative) path must be discarded, and the processor must start fetching from the correct path.
In case you don't know - custom analysis in VTune can be created by selecting any pre-defined analysis and pressing 'Customize...' button in the top-right corner.
E.g., you can select Microarchitecture Exploration, uncheck all checkboxes there, press 'Customize...', scroll down to the table with CPU events and uncheck all not needed/add needed events.
Regards