Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODETOOLS-7902949: jcstress: Warm up AllocationProfilingSupport support early #57

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions jcstress-core/src/main/java/org/openjdk/jcstress/ForkedMain.java
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@
import org.openjdk.jcstress.link.BinaryLinkClient;
import org.openjdk.jcstress.os.AffinitySupport;
import org.openjdk.jcstress.util.StringUtils;
import org.openjdk.jcstress.vm.AllocProfileSupport;

import java.lang.reflect.Constructor;

@@ -47,6 +48,10 @@ public static void main(String[] args) throws Exception {
throw new IllegalStateException("Expected three arguments");
}

// Pre-initialize the allocation profiling support, so that infrastructure
// code does not have to do this on critical path during the execution.
new WarmupAllocProfileTask().start();

boolean initLocalAffinity = Boolean.parseBoolean(args[0]);

if (initLocalAffinity) {
@@ -103,4 +108,15 @@ protected void internalRun() {
}
}

private static class WarmupAllocProfileTask extends VoidThread {
@Override
protected void internalRun() {
try {
AllocProfileSupport.getAllocatedBytes();
} catch (Exception e) {
// Do not care
}
}
}

}