Skip to content

Commit 0b8875e

Browse files
[GR-41197] Update conditional in PosixSubstrateSigprofHandler.
PullRequest: graal/17379
2 parents 8d75f34 + 7af7979 commit 0b8875e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixSubstrateSigprofHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.oracle.svm.core.option.SubstrateOptionsParser;
5656
import com.oracle.svm.core.posix.headers.Signal;
5757
import com.oracle.svm.core.posix.linux.LinuxSubstrateSigprofHandler;
58+
import com.oracle.svm.core.sampler.ProfilingSampler;
5859
import com.oracle.svm.core.sampler.SubstrateSigprofHandler;
5960
import com.oracle.svm.core.thread.ThreadListenerSupport;
6061
import com.oracle.svm.core.thread.ThreadListenerSupportFeature;
@@ -141,7 +142,7 @@ public List<Class<? extends Feature>> getRequiredFeatures() {
141142

142143
@Override
143144
public void afterRegistration(AfterRegistrationAccess access) {
144-
if (JfrExecutionSamplerSupported.isSupported() && isSignalHandlerBasedExecutionSamplerEnabled()) {
145+
if (JfrExecutionSamplerSupported.isSupported() && isSignalHandlerBasedExecutionSamplerEnabled() && useAsyncSampler()) {
145146
SubstrateSigprofHandler sampler = makeNewSigprofHandler();
146147
ImageSingletons.add(JfrExecutionSampler.class, sampler);
147148
ImageSingletons.add(SubstrateSigprofHandler.class, sampler);
@@ -151,6 +152,10 @@ public void afterRegistration(AfterRegistrationAccess access) {
151152
}
152153
}
153154

155+
private static boolean useAsyncSampler() {
156+
return !ImageSingletons.contains(ProfilingSampler.class) || ImageSingletons.lookup(ProfilingSampler.class).isAsyncSampler();
157+
}
158+
154159
private static SubstrateSigprofHandler makeNewSigprofHandler() {
155160
/*
156161
* For JFR, we should employ a global timer instead of a per-thread timer to adhere to the

0 commit comments

Comments
 (0)