Strange Result

Questions about YourKit Java Profiler
Post Reply
Tobias
Posts: 2
Joined: Wed Jun 10, 2015 10:22 am

Strange Result

Post by Tobias »

Hello,
I'm profiling a Scala-Application (as Scala runs on the JVM I would guess this should not lead to Problems?) and have strange results.

The measured duration of a specific method is far too high.
As this method is called on different occasions in the Code, it falsifies the results of the callers as well. This sadly leads to unusable results.

I get an duration of about 40% for this one method. When doing "In-Code"-Measurments or using another Profiler i get about 0.1%. Which is an reasonable Result considering the Code-Structure.

I have profiled several runs using sampling with different sampling rates (20ms and lower). Using low rates give an lower duration (but still way too high).
I'm profiling CPU only and have deactivated Exception- and Memory-Profiling.


The Method is (more or less) simply throwing an Exception.
Not sure if the following part maybe leads to problems:
The Exception is not "full-fleged". Its created without cause and Stacktrace.
(If this is relevant and you need more Details on this, let me know)


I hope you can help me to clarify the results :)
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Strange Result

Post by Anton Katilin »

Hello Tobias
The Method is (more or less) simply throwing an Exception.
As far as I understand, you're using CPU sampling. Sampling by its nature can be used to accurately measure only those methods whose call duration exceeds the sampling period. According to your explanation your method is trivial, and sampling is definitely a wrong tool to measure it.

Instead, please measure the method that calls your method. If its duration is comparable with the sampling period you'll get much better results.

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Strange Result

Post by Anton Katilin »

In other words, if you want to perform a micro-benchmarking, the internal in-code measurement approach may be the best for your particular case.
Tobias
Posts: 2
Joined: Wed Jun 10, 2015 10:22 am

Re: Strange Result

Post by Tobias »

Hello Anton,
thank you very much for your fast answer.

I'm not interrested in micro-benchmarking this method, but in profiling the whole Application.
The Problem is, this specific Method is shown with way to long duration-time in the Overview and I'm wondering what the cause of this problem could be.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Strange Result

Post by Anton Katilin »

In this case, please ignore results for this short leaf methods, and see instead results for its caller (or caller of its caller etc.) with an individual call duration exceeding the sampling period.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Strange Result

Post by Anton Katilin »

P.S. Please also consider CPU tracing.
Post Reply