Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package skunkworks;
- import jdk.jfr.Recording;
- import jdk.jfr.consumer.RecordingFile;
- import java.io.File;
- import java.io.IOException;
- import java.util.Map;
- public class TestCase {
- public static void main(String[] args) throws IOException {
- File tempDir = new File(".");
- var recording = new Recording(Map.of("jdk.ObjectAllocationOutsideTLAB#enabled", "true"));
- recording.setDestination(new File(tempDir.getAbsolutePath(), "rec.jfr").toPath());
- recording.start();
- for (int i = 0; i < 10; i++) {
- Thread.currentThread().setName("Iteration-" + i);
- var b = new byte[20 * 1024 * 1024];
- }
- recording.stop();
- recording.close();
- RecordingFile.readAllEvents(recording.getDestination()).forEach(e ->
- System.out.println(e.getThread().getJavaName()));
- tempDir.delete();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement