sbt / sbt-jmh

"Trust no one, bench everything." - sbt plugin for JMH (Java Microbenchmark Harness)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add recommended jvm options in async profiler

jvican opened this issue · comments

commented

The async profiler attaches/detaches itself from the measurement iterations on demand instead of doing it on startup via a java agent. In the docs of async-profiler, this is what it recommends if this is the case:

When agent is not loaded at JVM startup (by using -agentpath option) it is highly recommended to use -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints JVM flags. Without those flags the profiler will still work correctly but results might be less accurate e.g. without -XX:+DebugNonSafepoints there is a high chance that simple inlined methods will not appear in the profile. When agent is attached at runtime CompiledMethodLoad JVMTI event enables debug info, but only for methods compiled after the event is turned on.

Should we enable these two compilation flags by default in beforeIteration?

/cc @retronym

Yes, that looks like an oversight. I made the JFR profiler add those the forked JVM's startup. I'll try to do the same for async-profiler.

The other thing I've been meaning to do is adapt to OpenJDK support for JFR. OpenJDK 11 doesn't support the "EnableCommercialFeatures" flag or jcmd, flight recorder is available without that.