Currently the profiler looks for JFR jdk.ExecutionSample events. These are Java code running. We should also be counting jdk.NativeMethodSample events - which are when native code is running. These include blocked threads like I/O waits, so we'd need to do this:
String state = e.getString("state"); // e.g., "RUNNABLE", "SLEEPING", ...
if ("RUNNABLE".equals(state)) nativeOnCpu++;
to filter the counts of native events to only when the code is running. This should improve the accuracy of profiling.
Currently the profiler looks for JFR jdk.ExecutionSample events. These are Java code running. We should also be counting jdk.NativeMethodSample events - which are when native code is running. These include blocked threads like I/O waits, so we'd need to do this:
to filter the counts of native events to only when the code is running. This should improve the accuracy of profiling.