Skip to content

Instantly share code, notes, and snippets.

@parttimenerd
Last active February 20, 2023 11:57
Show Gist options
  • Save parttimenerd/502251b67d3e42baad17419442a72c39 to your computer and use it in GitHub Desktop.
Save parttimenerd/502251b67d3e42baad17419442a72c39 to your computer and use it in GitHub Desktop.
Tiny self-contained reproducer for https://bugs.openjdk.org/browse/JDK-8302320 (AsyncGetCallTrace obtains too few frames in sanity test)
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> klass = Main.class;
Method mainMethod = klass.getMethod("test");
mainMethod.invoke(null);
}
public static void test() {
javaLoop();
}
public static void javaLoop() {
long start = System.currentTimeMillis();
while (start + 3000 > System.currentTimeMillis());
}
}
#!/bin/sh
javac Main.java
java -cp . -XX:StartFlightRecording=filename=profile.jfr Main
jfr print --events "jdk.ExecutionSample" --json profile.jfr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment