0

Is there a tool available to profile java applications regarding branch (mis)prediction statistics for if statements?

I know VisualVM and JDK Mission Control but did not find such functionality.

1 Answer 1

0

No such tool exists.

It is generally impossible to extract that information from CPU, you can either measure performance of code block, or emulate execution of code and collect such statistic.

Sign up to request clarification or add additional context in comments.

1 Comment

CPUs do have hardware performance counters for branches and branch hits. Using perf stat --all-user java foo.jar will count overall (user-space only) branch miss stats for the whole Java process. perf record --all-user -e branch-misses ./a.out will record samples on branch misses, including for JITed machine code. Finding the JITed machine code for a specific if() in your Java source in the perf report output is probably a huge pain, unless you ran a microbenchmark and counted cycles,branch-misses so you could look for the code where your program spent most of its time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.