jdk.management.jfr.RecordingInfo Java Examples
The following examples show how to use
jdk.management.jfr.RecordingInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmxHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void verifyEquals(RecordingInfo ri, Recording r) { String destination = r.getDestination() != null ? r.getDestination().toString() : null; long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0; long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0; Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination"); Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit"); Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration"); Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id"); Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge"); Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize"); Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name"); Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size"); Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime"); Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state"); Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime"); verifyMapEquals(r.getSettings(), ri.getSettings()); }
Example #2
Source File: JmxHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static String asString(RecordingInfo r) { StringBuffer sb = new StringBuffer(); sb.append(String.format("RecordingInfo:%n")); sb.append(String.format("destination=%s%n", r.getDestination())); sb.append(String.format("dumpOnExit=%b%n", r.getDumpOnExit())); sb.append(String.format("duration=%d%n", r.getDuration())); sb.append(String.format("id=%d%n", r.getId())); sb.append(String.format("maxAge=%d%n", r.getMaxAge())); sb.append(String.format("maxSize=%d%n", r.getMaxSize())); sb.append(String.format("getName=%s%n", r.getName())); sb.append(String.format("size=%d%n", r.getSize())); sb.append(String.format("startTime=%d%n", r.getStartTime())); sb.append(String.format("state=%s%n", r.getState())); sb.append(String.format("stopTime=%d%n", r.getStopTime())); return sb.toString(); }
Example #3
Source File: TestRecordingState.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); bean.startRecording(recId); JmxHelper.verifyState(recId, RecordingState.RUNNING, bean); bean.stopRecording(recId); JmxHelper.verifyState(recId, RecordingState.STOPPED, bean); bean.closeRecording(recId); JmxHelper.verifyNotExists(recId, bean.getRecordings()); }
Example #4
Source File: TestSnapshot.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void testStopped() throws IOException { try (Recording r = new Recording()) { r.enable(SimpleEvent.class); r.start(); SimpleEvent se = new SimpleEvent(); se.commit(); r.stop(); try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) { r.close(); FlightRecorderMXBean mxBean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> recs = mxBean.getRecordings(); JmxHelper.verifyEquals(recs.get(0), snapshot); } } }
Example #5
Source File: JmxHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void verifyEquals(RecordingInfo ri, Recording r) { String destination = r.getDestination() != null ? r.getDestination().toString() : null; long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0; long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0; Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination"); Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit"); Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration"); Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id"); Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge"); Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize"); Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name"); Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size"); Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime"); Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state"); Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime"); verifyMapEquals(r.getSettings(), ri.getSettings()); }
Example #6
Source File: TestRecordingInfo.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { Recording recording = new Recording(Configuration.getConfiguration("profile")); recording.setDestination(Paths.get(".", "my.jfr")); recording.setDumpOnExit(true); recording.setDuration(Duration.ofSeconds(60)); recording.setMaxAge(Duration.ofHours(1)); recording.setMaxSize(123456789); recording.setName("myName"); recording.enable("java.exception_throw").with("threashold", "2 s"); recording.setToDisk(true); recording.start(); CommonHelper.verifyRecordingState(recording, RecordingState.RUNNING); // Wait until running FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); RecordingInfo info = JmxHelper.verifyExists(recording.getId(), bean.getRecordings()); System.out.println(JmxHelper.asString(recording)); System.out.println(JmxHelper.asString(info)); JmxHelper.verifyEquals(info, recording); recording.stop(); recording.close(); }
Example #7
Source File: TestSnapshot.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void testStopped() throws IOException { try (Recording r = new Recording()) { r.enable(SimpleEvent.class); r.start(); SimpleEvent se = new SimpleEvent(); se.commit(); r.stop(); try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) { r.close(); FlightRecorderMXBean mxBean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> recs = mxBean.getRecordings(); JmxHelper.verifyEquals(recs.get(0), snapshot); } } }
Example #8
Source File: TestPredefinedConfiguration.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example #9
Source File: TestRecordingState.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); bean.startRecording(recId); JmxHelper.verifyState(recId, RecordingState.RUNNING, bean); bean.stopRecording(recId); JmxHelper.verifyState(recId, RecordingState.STOPPED, bean); bean.closeRecording(recId); JmxHelper.verifyNotExists(recId, bean.getRecordings()); }
Example #10
Source File: JmxHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static String asString(RecordingInfo r) { StringBuffer sb = new StringBuffer(); sb.append(String.format("RecordingInfo:%n")); sb.append(String.format("destination=%s%n", r.getDestination())); sb.append(String.format("dumpOnExit=%b%n", r.getDumpOnExit())); sb.append(String.format("duration=%d%n", r.getDuration())); sb.append(String.format("id=%d%n", r.getId())); sb.append(String.format("maxAge=%d%n", r.getMaxAge())); sb.append(String.format("maxSize=%d%n", r.getMaxSize())); sb.append(String.format("getName=%s%n", r.getName())); sb.append(String.format("size=%d%n", r.getSize())); sb.append(String.format("startTime=%d%n", r.getStartTime())); sb.append(String.format("state=%s%n", r.getState())); sb.append(String.format("stopTime=%d%n", r.getStopTime())); return sb.toString(); }
Example #11
Source File: TestPredefinedConfiguration.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example #12
Source File: TestRecordingInfo.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { Recording recording = new Recording(Configuration.getConfiguration("profile")); recording.setDestination(Paths.get(".", "my.jfr")); recording.setDumpOnExit(true); recording.setDuration(Duration.ofSeconds(60)); recording.setMaxAge(Duration.ofHours(1)); recording.setMaxSize(123456789); recording.setName("myName"); recording.enable("java.exception_throw").with("threashold", "2 s"); recording.setToDisk(true); recording.start(); CommonHelper.verifyRecordingState(recording, RecordingState.RUNNING); // Wait until running FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); RecordingInfo info = JmxHelper.verifyExists(recording.getId(), bean.getRecordings()); System.out.println(JmxHelper.asString(recording)); System.out.println(JmxHelper.asString(info)); JmxHelper.verifyEquals(info, recording); recording.stop(); recording.close(); }
Example #13
Source File: JmxHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void verifyEquals(RecordingInfo ri, Recording r) { String destination = r.getDestination() != null ? r.getDestination().toString() : null; long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0; long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0; Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination"); Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit"); Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration"); Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id"); Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge"); Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize"); Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name"); Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size"); Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime"); Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state"); Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime"); verifyMapEquals(r.getSettings(), ri.getSettings()); }
Example #14
Source File: JmxHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static String asString(RecordingInfo r) { StringBuffer sb = new StringBuffer(); sb.append(String.format("RecordingInfo:%n")); sb.append(String.format("destination=%s%n", r.getDestination())); sb.append(String.format("dumpOnExit=%b%n", r.getDumpOnExit())); sb.append(String.format("duration=%d%n", r.getDuration())); sb.append(String.format("id=%d%n", r.getId())); sb.append(String.format("maxAge=%d%n", r.getMaxAge())); sb.append(String.format("maxSize=%d%n", r.getMaxSize())); sb.append(String.format("getName=%s%n", r.getName())); sb.append(String.format("size=%d%n", r.getSize())); sb.append(String.format("startTime=%d%n", r.getStartTime())); sb.append(String.format("state=%s%n", r.getState())); sb.append(String.format("stopTime=%d%n", r.getStopTime())); return sb.toString(); }
Example #15
Source File: TestRecordingInfo.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { Recording recording = new Recording(Configuration.getConfiguration("profile")); recording.setDestination(Paths.get(".", "my.jfr")); recording.setDumpOnExit(true); recording.setDuration(Duration.ofSeconds(60)); recording.setMaxAge(Duration.ofHours(1)); recording.setMaxSize(123456789); recording.setName("myName"); recording.enable("java.exception_throw").with("threashold", "2 s"); recording.setToDisk(true); recording.start(); CommonHelper.verifyRecordingState(recording, RecordingState.RUNNING); // Wait until running FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); RecordingInfo info = JmxHelper.verifyExists(recording.getId(), bean.getRecordings()); System.out.println(JmxHelper.asString(recording)); System.out.println(JmxHelper.asString(info)); JmxHelper.verifyEquals(info, recording); recording.stop(); recording.close(); }
Example #16
Source File: TestPredefinedConfiguration.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); List<String> configNames = new ArrayList<>(); for (Configuration config : Configuration.getConfigurations()) { System.out.println("name=" + config.getName()); configNames.add(config.getName()); bean.setPredefinedConfiguration(recId, config.getName()); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); JmxHelper.verifyMapEquals(jmxRecording.getSettings(), config.getSettings()); JmxHelper.verifyMapEquals(bean.getRecordingSettings(recId), config.getSettings()); } Asserts.assertTrue(configNames.contains("default"), "Missing config 'default'"); Asserts.assertTrue(configNames.contains("profile"), "Missing config 'profile'"); }
Example #17
Source File: TestSnapshot.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void testStopped() throws IOException { try (Recording r = new Recording()) { r.enable(SimpleEvent.class); r.start(); SimpleEvent se = new SimpleEvent(); se.commit(); r.stop(); try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) { r.close(); FlightRecorderMXBean mxBean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> recs = mxBean.getRecordings(); JmxHelper.verifyEquals(recs.get(0), snapshot); } } }
Example #18
Source File: TestRecordingState.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); bean.startRecording(recId); JmxHelper.verifyState(recId, RecordingState.RUNNING, bean); bean.stopRecording(recId); JmxHelper.verifyState(recId, RecordingState.STOPPED, bean); bean.closeRecording(recId); JmxHelper.verifyNotExists(recId, bean.getRecordings()); }
Example #19
Source File: JmxHelper.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void verifyEquals(RecordingInfo ri, Recording r) { String destination = r.getDestination() != null ? r.getDestination().toString() : null; long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0; long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0; Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination"); Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit"); Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration"); Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id"); Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge"); Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize"); Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name"); Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size"); Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime"); Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state"); Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime"); verifyMapEquals(r.getSettings(), ri.getSettings()); }
Example #20
Source File: JmxHelper.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static String asString(RecordingInfo r) { StringBuffer sb = new StringBuffer(); sb.append(String.format("RecordingInfo:%n")); sb.append(String.format("destination=%s%n", r.getDestination())); sb.append(String.format("dumpOnExit=%b%n", r.getDumpOnExit())); sb.append(String.format("duration=%d%n", r.getDuration())); sb.append(String.format("id=%d%n", r.getId())); sb.append(String.format("maxAge=%d%n", r.getMaxAge())); sb.append(String.format("maxSize=%d%n", r.getMaxSize())); sb.append(String.format("getName=%s%n", r.getName())); sb.append(String.format("size=%d%n", r.getSize())); sb.append(String.format("startTime=%d%n", r.getStartTime())); sb.append(String.format("state=%s%n", r.getState())); sb.append(String.format("stopTime=%d%n", r.getStopTime())); return sb.toString(); }
Example #21
Source File: TestGetRecordingsMultiple.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void verifyExistingRecordings(List<TestRecording> testRecordings) { for (TestRecording testRecording : testRecordings) { RecordingInfo r = findRecording(testRecording); if (r != null) { Asserts.assertFalse(testRecording.isClosed, "Found closed recording with id " + testRecording.id); System.out.printf("Recording %d: %s%n", r.getId(), r.getState()); } else { Asserts.assertTrue(testRecording.isClosed, "Missing recording with id " + testRecording.id); System.out.printf("Recording %d: CLOSED%n", testRecording.id); } } }
Example #22
Source File: TestMultipleRecordings.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static long createRecording(FlightRecorderMXBean bean) throws Exception { List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); return recId; }
Example #23
Source File: TestSnapshot.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void testEmpty() throws IOException { try (Recording snapshot = FlightRecorder.getFlightRecorder().takeSnapshot()) { FlightRecorderMXBean mxBean = JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> recs = mxBean.getRecordings(); JmxHelper.verifyEquals(recs.get(0), snapshot); } }
Example #24
Source File: TestSetConfiguration.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long recId = bean.newRecording(); final String configContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" + "<configuration version=\"2.0\" label=\"TestName\" description='TestDesc' provider='TestProvider'>\n" + " <event name=\"" + EventNames.ClassLoad +"\">\r" + " \t <setting name=\"enabled\" control='class-loading-enabled'>false</setting>\r\n" + " <setting name=\"stackTrace\">true</setting>\t\r\n" + " <setting name=\"threshold\">5 ms</setting> \n" + " </event> " + " <control> " + " <flag name=\"class-loading-enabled\" label=\"Class Loading\">false</flag>\n" + " </control>" + "</configuration>"; Map<String, String> expectedSetting = new HashMap<>(); expectedSetting.put(EventNames.ClassLoad + "#enabled", "false"); expectedSetting.put(EventNames.ClassLoad + "#stackTrace", "true"); expectedSetting.put(EventNames.ClassLoad + "#threshold", "5 ms"); bean.setConfiguration(recId, configContents); RecordingInfo jmxRecording = JmxHelper.getJmxRecording(recId); Recording javaRecording = JmxHelper.getJavaRecording(recId); JmxHelper.verifyEquals(jmxRecording, javaRecording); Map<String, String> settings = jmxRecording.getSettings(); for (String name : expectedSetting.keySet()) { String value = settings.remove(name); Asserts.assertNotNull(value, "No setting with name " + name); Asserts.assertEquals(value, expectedSetting.get(name), "Wrong setting value"); } Asserts.assertTrue(settings.isEmpty(), "Extra settings found " + settings.keySet()); }
Example #25
Source File: TestGetRecordingsMultiple.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static RecordingInfo findRecording(TestRecording testRecording) { for (RecordingInfo r : JmxHelper.getFlighteRecorderMXBean().getRecordings()) { if (r.getId() == testRecording.id) { return r; } } return null; }
Example #26
Source File: TestGetRecordingsMultiple.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void verifyExistingRecordings(List<TestRecording> testRecordings) { for (TestRecording testRecording : testRecordings) { RecordingInfo r = findRecording(testRecording); if (r != null) { Asserts.assertFalse(testRecording.isClosed, "Found closed recording with id " + testRecording.id); System.out.printf("Recording %d: %s%n", r.getId(), r.getState()); } else { Asserts.assertTrue(testRecording.isClosed, "Missing recording with id " + testRecording.id); System.out.printf("Recording %d: CLOSED%n", testRecording.id); } } }
Example #27
Source File: TestClone.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); long orgId = bean.newRecording(); bean.startRecording(orgId); SimpleEventHelper.createEvent(1); // Should be in both org and clone long cloneId = bean.cloneRecording(orgId, false); Asserts.assertNotEquals(orgId, cloneId, "clone id should not be same as org id"); List<RecordingInfo> recordings = bean.getRecordings(); JmxHelper.verifyState(orgId, RecordingState.RUNNING, recordings); JmxHelper.verifyState(cloneId, RecordingState.RUNNING, recordings); bean.stopRecording(orgId); recordings = bean.getRecordings(); JmxHelper.verifyState(orgId, RecordingState.STOPPED, recordings); JmxHelper.verifyState(cloneId, RecordingState.RUNNING, recordings); SimpleEventHelper.createEvent(2); // Should only be in clone bean.stopRecording(cloneId); recordings = bean.getRecordings(); JmxHelper.verifyState(orgId, RecordingState.STOPPED, recordings); JmxHelper.verifyState(cloneId, RecordingState.STOPPED, recordings); Path orgPath = Paths.get(".", "org.jfr"); Path clonePath = Paths.get(".", "clone.jfr"); bean.copyTo(orgId, orgPath.toString()); bean.copyTo(cloneId, clonePath.toString()); verifyEvents(orgPath, 1); verifyEvents(clonePath, 1, 2); bean.closeRecording(orgId); bean.closeRecording(cloneId); }
Example #28
Source File: TestGetRecordings.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Throwable { FlightRecorderMXBean bean =JmxHelper.getFlighteRecorderMXBean(); List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); bean.closeRecording(recId); JmxHelper.verifyNotExists(recId, bean.getRecordings()); }
Example #29
Source File: TestRecordingStateInvalid.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static long createRecording(FlightRecorderMXBean bean) throws Exception { List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); return recId; }
Example #30
Source File: TestMultipleRecordings.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static long createRecording(FlightRecorderMXBean bean) throws Exception { List<RecordingInfo> preCreateRecordings = bean.getRecordings(); long recId = bean.newRecording(); JmxHelper.verifyNotExists(recId, preCreateRecordings); JmxHelper.verifyState(recId, RecordingState.NEW, bean); return recId; }