Java Code Examples for jdk.jfr.FlightRecorder#unregister()
The following examples show how to use
jdk.jfr.FlightRecorder#unregister() .
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: TestActiveSettingEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void testUnregistered() throws Exception { FlightRecorder.register(MyEvent.class); EventType type = EventType.getEventType(MyEvent.class); FlightRecorder.unregister(MyEvent.class); try (Recording recording = new Recording()) { recording.enable(ACTIVE_SETTING_EVENT_NAME); recording.start(); MyEvent m = new MyEvent(); m.commit(); recording.stop(); List<RecordedEvent> events = Events.fromRecording(recording); Events.hasEvents(events); assertNotSetting(events, type, "threshold", "0 ns"); assertNotSetting(events, type, "enabled", "true"); assertNotSetting(events, type, "stackTrace", "true"); } }
Example 2
Source File: TestActiveSettingEvent.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void testUnregistered() throws Exception { FlightRecorder.register(MyEvent.class); EventType type = EventType.getEventType(MyEvent.class); FlightRecorder.unregister(MyEvent.class); try (Recording recording = new Recording()) { recording.enable(ACTIVE_SETTING_EVENT_NAME); recording.start(); MyEvent m = new MyEvent(); m.commit(); recording.stop(); List<RecordedEvent> events = Events.fromRecording(recording); Events.hasEvents(events); assertNotSetting(events, type, "threshold", "0 ns"); assertNotSetting(events, type, "enabled", "true"); assertNotSetting(events, type, "stackTrace", "true"); } }
Example 3
Source File: TestActiveSettingEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void testUnregistered() throws Exception { FlightRecorder.register(MyEvent.class); EventType type = EventType.getEventType(MyEvent.class); FlightRecorder.unregister(MyEvent.class); try (Recording recording = new Recording()) { recording.enable(ACTIVE_SETTING_EVENT_NAME); recording.start(); MyEvent m = new MyEvent(); m.commit(); recording.stop(); List<RecordedEvent> events = Events.fromRecording(recording); Events.hasEvents(events); assertNotSetting(events, type, "threshold", "0 ns"); assertNotSetting(events, type, "enabled", "true"); assertNotSetting(events, type, "stackTrace", "true"); } }
Example 4
Source File: TestRecordingFile.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void testReadEventTypeWithUnregistration(boolean disk, boolean background) throws Exception { FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); FlightRecorder.register(Event3.class); Recording backgrundRecording = new Recording(); if (disk) { backgrundRecording.setToDisk(disk); } if (background) { backgrundRecording.start(); } recordAndVerify(disk, background,new int[] {1,2, 3}, new int[] {}); FlightRecorder.unregister(Event2.class); recordAndVerify(disk, background, new int[] {1, 3}, new int[] {2}); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk,background, new int[] {2, 3}, new int[] {1}); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event3.class); FlightRecorder.unregister(Event2.class); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event1.class); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk, background,new int[] {1, 2}, new int[] {3}); if (background) { backgrundRecording.close(); } }
Example 5
Source File: TestRecordingFile.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void testReadEventTypeWithUnregistration(boolean disk, boolean background) throws Exception { FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); FlightRecorder.register(Event3.class); Recording backgrundRecording = new Recording(); if (disk) { backgrundRecording.setToDisk(disk); } if (background) { backgrundRecording.start(); } recordAndVerify(disk, background,new int[] {1,2, 3}, new int[] {}); FlightRecorder.unregister(Event2.class); recordAndVerify(disk, background, new int[] {1, 3}, new int[] {2}); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk,background, new int[] {2, 3}, new int[] {1}); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event3.class); FlightRecorder.unregister(Event2.class); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event1.class); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk, background,new int[] {1, 2}, new int[] {3}); if (background) { backgrundRecording.close(); } }
Example 6
Source File: TestRecordingFile.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testReadEventTypeWithUnregistration(boolean disk, boolean background) throws Exception { FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); FlightRecorder.register(Event3.class); Recording backgrundRecording = new Recording(); if (disk) { backgrundRecording.setToDisk(disk); } if (background) { backgrundRecording.start(); } recordAndVerify(disk, background,new int[] {1,2, 3}, new int[] {}); FlightRecorder.unregister(Event2.class); recordAndVerify(disk, background, new int[] {1, 3}, new int[] {2}); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk,background, new int[] {2, 3}, new int[] {1}); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event3.class); FlightRecorder.unregister(Event2.class); FlightRecorder.unregister(Event3.class); FlightRecorder.register(Event1.class); FlightRecorder.unregister(Event1.class); FlightRecorder.register(Event1.class); FlightRecorder.register(Event2.class); recordAndVerify(disk, background,new int[] {1, 2}, new int[] {3}); if (background) { backgrundRecording.close(); } }
Example 7
Source File: TestClonedEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.enable(MyEvent.class); r.start(); MyEvent event = new MyEvent(); MyEvent event2 = (MyEvent)event.clone(); FlightRecorder.register(MyEvent.class); event.commit(); event2.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Asserts.assertEquals(2, events.size()); r.close(); FlightRecorder.unregister(MyEvent.class); Recording r2 = new Recording(); r2.enable(MyEvent.class); r2.start(); event.commit(); event2.commit(); r2.stop(); events = Events.fromRecording(r2); Asserts.assertEquals(0, events.size()); r2.close(); }
Example 8
Source File: TestClonedEvent.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.enable(MyEvent.class); r.start(); MyEvent event = new MyEvent(); MyEvent event2 = (MyEvent)event.clone(); FlightRecorder.register(MyEvent.class); event.commit(); event2.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Asserts.assertEquals(2, events.size()); r.close(); FlightRecorder.unregister(MyEvent.class); Recording r2 = new Recording(); r2.enable(MyEvent.class); r2.start(); event.commit(); event2.commit(); r2.stop(); events = Events.fromRecording(r2); Asserts.assertEquals(0, events.size()); r2.close(); }
Example 9
Source File: TestClonedEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) throws Throwable { Recording r = new Recording(); r.enable(MyEvent.class); r.start(); MyEvent event = new MyEvent(); MyEvent event2 = (MyEvent)event.clone(); FlightRecorder.register(MyEvent.class); event.commit(); event2.commit(); r.stop(); List<RecordedEvent> events = Events.fromRecording(r); Asserts.assertEquals(2, events.size()); r.close(); FlightRecorder.unregister(MyEvent.class); Recording r2 = new Recording(); r2.enable(MyEvent.class); r2.start(); event.commit(); event2.commit(); r2.stop(); events = Events.fromRecording(r2); Asserts.assertEquals(0, events.size()); r2.close(); }