Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Yourkit measures time spent on unsafe.park native method?

I know that Yourkit measures wall time for methods like Thread.sleep(), but what about the unsafe.park native method? Bellows are the sampling settings:

walltime=java.io.RandomAccessFile : readBytes(byte[], int, int) walltime=java.io.RandomAccessFile : read() walltime=java.io.RandomAccessFile : write(int) walltime=java.io.RandomAccessFile : writeBytes(byte[], int, int) walltime=java.net.SocketInputStream : socketRead0(java.io.FileDescriptor, byte[], int, int, int) walltime=java.net.SocketOutputStream : socketWrite0(java.io.FileDescriptor, byte[], int, int) walltime=java.lang.Thread : sleep(*)

sampling_period_ms=20

It seemed that unsafe.park() is not using walltime, so it must be CPU time. Based on the Yourkit documentation the CPU time is the actual time that CPU spent on this method, not just the time between entrance and exit of the method.

Yourkit showed that a lot of time is spent on the park() method, but I don't think the CPU spent a lot of time on the park() method. Could you please confirm on this? Thanks.

like image 341
Adrian Liu Avatar asked Sep 28 '22 07:09

Adrian Liu


1 Answers

By default YourKit profiler does not show Unsafe.park(). Profiler agent measures time, but UI does not show it. To change this please specify -Dyjp.zero.time.methods=false in yjp.ini and restart the profiler UI.

like image 88
Vladimir Kondratyev Avatar answered Oct 24 '22 06:10

Vladimir Kondratyev