Method invocations in sampling but not tracing

Questions about YourKit Java Profiler
Post Reply
nfortescue
Posts: 7
Joined: Wed Sep 01, 2004 3:01 pm

Method invocations in sampling but not tracing

Post by nfortescue »

As I understood it, tracing may slow down the application being profiled, but will always show more than sampling. I've got some code that when I profile it in sampling mode, methods are shown that are not mentioned when I use method tracing. Is it a bug?

JDK1.5
YourKit 3.1 EAP build 437
running from Ant

By the way - another comment. 3.1 EAP shows 3.0 on the splash screen and help-about. That just confused me when reporting this.
Vladimir Kondratyev
Posts: 1625
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

As I understood it, tracing may slow down the application being profiled, but will always show more than sampling. I've got some code that when I profile it in sampling mode, methods are shown that are not mentioned when I use method tracing. Is it a bug?
Number of method calls is available in "tracing" mode only. "sampling" is fast because it doesn't gather this information (often this information is not required).
By the way - another comment. 3.1 EAP shows 3.0 on the splash screen and help-about. That just confused me when reporting this.
This problem is already fixed in build #439 (it's available for download at http://www.yourkit.com/eap/)
nfortescue
Posts: 7
Joined: Wed Sep 01, 2004 3:01 pm

Post by nfortescue »

I understand that.

I used sampling. This told me that method a() was spending most time in method b(). I wanted to know how many invocations, so I switched to tracing. After I used tracing, method b() just was not shown anymore, instead, the trace justs topped at method a(). I'm sorry if that wasn't clear.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

This may an issue with HotSpot JVM which inlines methods for optimization purposes, and method enter/exit events used in tracing are not issued by Java in that case. Sampling does not use these events, instead it periodically gets stack traces of threads to estimate the branches of execution where most of time is spent. As a workaround/test you can add -Xint JVM parameter to the command line of profile application to use interpreted JVM mode with tracing. The drawback of interpreted mode is the slowdown of profiled application.
Post Reply