Interpreting CPU profiling results with sleep and park

Questions about YourKit Java Profiler
Post Reply
jimfcarroll
Posts: 1
Joined: Wed May 12, 2021 12:42 pm

Interpreting CPU profiling results with sleep and park

Post by jimfcarroll »

I don't understand some of the profiling results I'm seeing. For example:

In a snapshot I see flames and 100% in [walltime] java.lang.Thread.sleep. Why is sleep being interpreted as CPU heavy.

Also, in the running threads view I see similar results for java.lang.Object.wait (100% with flames) and Unsafe.park. This makes it really difficult to sort out real users of the CPU from functions that are effectively not using it.

I do not have any -D options set post installing YourKit.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Interpreting CPU profiling results with sleep and park

Post by Anton Katilin »

sleep() and others may be measured by default as wall time, please see the section "Configuring the settings" at https://www.yourkit.com/docs/java/help/ ... ttings.jsp

To change future measurements, use the preset "Measure CPU time for all methods" via "Use Preconfigured Settings".

To exclude method(s) in an already obtained snapshot, use https://www.yourkit.com/docs/java/help/cpu_what_if.jsp
Post Reply