Skip to content

Commit

Permalink
Update conditional in PosixSubstrateSigprofHandler.
Browse files Browse the repository at this point in the history
  • Loading branch information
jovanstevanovic committed Apr 17, 2024
1 parent 104613f commit 4f2cba1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import com.oracle.svm.core.posix.darwin.DarwinSubstrateSigprofHandler;
import com.oracle.svm.core.posix.headers.Signal;
import com.oracle.svm.core.posix.linux.LinuxSubstrateSigprofHandler;
import com.oracle.svm.core.sampler.ProfilingSampler;
import com.oracle.svm.core.sampler.SubstrateSigprofHandler;
import com.oracle.svm.core.thread.ThreadListenerSupport;
import com.oracle.svm.core.thread.ThreadListenerSupportFeature;
Expand Down Expand Up @@ -141,7 +142,7 @@ public List<Class<? extends Feature>> getRequiredFeatures() {

@Override
public void afterRegistration(AfterRegistrationAccess access) {
if (JfrExecutionSamplerSupported.isSupported() && isSignalHandlerBasedExecutionSamplerEnabled()) {
if (JfrExecutionSamplerSupported.isSupported() && isSignalHandlerBasedExecutionSamplerEnabled() && useAsyncSampler()) {
SubstrateSigprofHandler sampler = makeNewSigprofHandler();
ImageSingletons.add(JfrExecutionSampler.class, sampler);
ImageSingletons.add(SubstrateSigprofHandler.class, sampler);
Expand All @@ -151,6 +152,10 @@ public void afterRegistration(AfterRegistrationAccess access) {
}
}

private static boolean useAsyncSampler() {
return !ImageSingletons.contains(ProfilingSampler.class) || ImageSingletons.lookup(ProfilingSampler.class).isAsyncSampler();
}

private static SubstrateSigprofHandler makeNewSigprofHandler() {
if (Platform.includedIn(Platform.LINUX.class)) {
return new LinuxSubstrateSigprofHandler();
Expand Down

0 comments on commit 4f2cba1

Please sign in to comment.