Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:46:28+00:00 2026-06-07T21:46:28+00:00

This question and its answer, which was recently tagged as an Epic Answer, has

  • 0

This question and its answer, which was recently tagged as an Epic Answer, has prompted me to wonder; Can I measure the performance of a running application in Windows in terms of its CPU branch prediction failures? I know that some static analysis tools exist, that might help with optimizing code for good performance in branch-prediction situations, and that manual techniques could help by simply making changes and re-testing, but I’m looking for some automatic mechanism that can report a total number of branch prediction failures, over a period of time, as a Windows application runs, and I’m hoping that some Profiler tool for Visual C++ could help me.

For the sake of this question, the application in question is either built with a native-compiler such as Visual C++ for Windows, or using some other native compiler, such as GCC, FreePascal, Delphi, or TurboAssembler. The executable may not have any debug information at all. I want to know if I can detect, and count branch prediction failures, perhaps by reading internal CPU information through some Windows service like WMI, or perhaps by running entirely inside a virtualized environment running Windows, such as using VirtualBox, and then running a completely virtualized windows environment with my test application, inside VirtualBox, and doing runtime analysis of the virtual CPU. Or some other technique that I don’t know of, thus this question.

Yes, I googled. The only thing that looks promising is this PDF from AMD. Page 18 mentions something very close to what I’d like to do, but seems written for those working without any operating system, on raw evaluation hardware platforms:

5.1. Branches. Applicability. Conditional branch mispredictions may be a significant issue in code with a lot of decision-making logic.

Conditional branches may be mispredicted when the likelihood of
choosing the true or false path is random or near a 50-50 split. The
branch prediction hardware cannot “learn” a pattern and branches are
not predicted correctly. Collection. Collect the events in this table
to measure branch prediction performance:

Branches Compute the rate at which branches are
taken and the ratio of the number of instructions per branch using
these formulas: Branch taken rate = Taken_branches /
Ret_instructions Branch taken ratio = Taken_branches / Branches
Instructions per branch = Ret_instructions / Branches

Update: I guess I could say I’m looking for a way to read the Intel Core i7 PMU module, or equivalent functions of other CPUs. It looks like Intel VTUNE (from the comments by Adrian) is very close to what I asked for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:46:30+00:00Added an answer on June 7, 2026 at 9:46 pm

    VTune Performance Analyzer can do it! Btw if you are studying these topics, take a look at “Optimization Cookbook” from Intel Press.

    Note: Comments state the same answer but with some uncertainty, I used VTune and I measured the branch prediction rate for an Intel CPU. So I’m 100% sure.

    here is the link for VTune

    here is the link for the book

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question (along with its answer) explains why you can't easily bind a DataGridView
I found this question , which has an answer, but facebook changed the token
This question relates very closely to Can a nested C++ class inherit its enclosing
This is a follow up question from here specifically concerning its answer . From
I think the answer to this question is so obivous that noone has bothered
I have seen this question and its answers and they clear up some of
As a followup to this two questions and its answers Question 1 and Question
I have read this question and the simple and clear answer but it's not
I have seen many answers for this type of question but its not related
The first part of this question is now its own, here: Analyzing Text for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.