Amir Hadadi
Amir Hadadi

Reputation: 521

Java Mission Control 7.1 shows too few method profiling samples

A similar question was asked here.

I'm profiling an Open JDK 11.0.2 application using JMC 7.1.0 which I've built according to the instructions.

The application is utilizing about 3 cores, there is no excessive gc and only a small portion of the time threads are doing native method calls that actually utilize CPU.

I'm using the default method sampling interval of 10ms. I enabled debug meta data outside of safepoints by using:

-XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints

The number of samples taken is much less then I expect. Assuming conservatively that there is 1 on cpu thread running non native code at each sampling point, I would expect 100 samples / second. Yet I'm seeing only 1 sample / second.

cpu usage & method samples

The machine itself is usually 50% idle, so the sampling thread is not starved.

What can be causing the number of samples to be that low?

Upvotes: 4

Views: 1429

Answers (1)

Kire Haglin
Kire Haglin

Reputation: 7069

This is probably due to a bug introduced in JDK 11 which appear in applications with many threads. It has been fixed in JDK 12 and backported to 11.0.3.

For details see:

https://bugs.openjdk.java.net/browse/JDK-8215727

Regarding the sampling interval. The default rate is 20 ms, but it doesn't mean there will be 50 samples / seconds. It is the interval the JVM tries to samples one or more threads.

Upvotes: 2

Related Questions