How to know which method is calling a specific method?

Questions about YourKit Java Profiler
Locked
javadevmtl
Posts: 2
Joined: Wed Aug 05, 2020 1:53 am

How to know which method is calling a specific method?

Post by javadevmtl »

Hi running the profiler. I see that

java.util.HashSet.add

Time(ms): 49,000(91%)
Own Time(ms): 49,000

-1 Does that mean that this is taking up CPU, because it seems I have high CPU usage 50%+ , when I restart the application the CPU usage is low, even with same amount of load?
-2 How can I see who is calling the add of the HashSet?

GC looks good, memory seems to clean up.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: How to know which method is calling a specific method?

Post by Anton Katilin »

Hi,
-1 Does that mean that this is taking up CPU, because it seems I have high CPU usage 50%+
Yes, why not.
However, since you apparently use synchronous sampling, there is likely a bias:
https://www.yourkit.com/docs/java/help/sampling.jsp

To avoid it, try asynchronous sampling if it's available on your platform:
https://www.yourkit.com/docs/java/help/ ... ng_cpu.jsp
-2 How can I see who is calling the add of the HashSet?
https://www.yourkit.com/docs/java/help/ ... traces.jsp
javadevmtl
Posts: 2
Joined: Wed Aug 05, 2020 1:53 am

Re: How to know which method is calling a specific method?

Post by javadevmtl »

I don't see Hotspots item on the left to see the call trace. I assume I need a snapshot for that to work?

I took some screens...

https://www.dropbox.com/sh/ejcddp2gcml8 ... fDh3a?dl=0

This is on low application usage, usually the CPU is at 1% user time eventually it will go higher to 50% and more at which point the application slows down and I have to restart it.

From what I have seen the GC is low and memory does reclaim itself correctly.
Locked