Running the following program:
import jdk.jfr.Recording;
import jdk.jfr.Configuration;
public class P {
public static void main(String... args) throws Exception {
Configuration c = Configuration.getConfiguration("default");
try (Recording r = new Recording(c)) {
r.start();
Thread.sleep(10_000);
}
System.out.println("Recording finished");
Thread.sleep(1000_000);
}
}
With the following line added to RequestEngine.java:
private static long run_requests(Collection<RequestHook> entries, long eventTimestamp) {
long last = lastTimeMillis;
+ System.out.println("Time: " + last);
// The interval for periodic events is typically at least 1 s, so
// System.currentTimeMillis() is sufficient. JVM.counterTime() lacks
results in:
Time: 1676829368686
Time: 1676829368699
Time: 1676829368711
Time: 1676829368722
Time: 1676829368735
Time: 1676829368747
Time: 1676829368760
Time: 1676829368773
...
The "JFR Periodic Task" thread runs back-to-back, with about 13 ms between each each turn. One would expect the thread to be stopped or at least sleep/wait when a recording is finished. Furthermore, flush calls are made into JVM.after native JFR has been destroyed.
I think this can explain som strange things we have seen, crashes or timeouts.
import jdk.jfr.Recording;
import jdk.jfr.Configuration;
public class P {
public static void main(String... args) throws Exception {
Configuration c = Configuration.getConfiguration("default");
try (Recording r = new Recording(c)) {
r.start();
Thread.sleep(10_000);
}
System.out.println("Recording finished");
Thread.sleep(1000_000);
}
}
With the following line added to RequestEngine.java:
private static long run_requests(Collection<RequestHook> entries, long eventTimestamp) {
long last = lastTimeMillis;
+ System.out.println("Time: " + last);
// The interval for periodic events is typically at least 1 s, so
// System.currentTimeMillis() is sufficient. JVM.counterTime() lacks
results in:
Time: 1676829368686
Time: 1676829368699
Time: 1676829368711
Time: 1676829368722
Time: 1676829368735
Time: 1676829368747
Time: 1676829368760
Time: 1676829368773
...
The "JFR Periodic Task" thread runs back-to-back, with about 13 ms between each each turn. One would expect the thread to be stopped or at least sleep/wait when a recording is finished. Furthermore, flush calls are made into JVM.after native JFR has been destroyed.
I think this can explain som strange things we have seen, crashes or timeouts.