Java Code Examples for jdk.jfr.internal.JVM#createNativeJFR()
The following examples show how to use
jdk.jfr.internal.JVM#createNativeJFR() .
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: TestGetAllEventClasses.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws ClassNotFoundException { JVM jvm = JVM.getJVM(); // before creating native assertEmptyEventList(jvm); jvm.createNativeJFR(); // after creating native assertEmptyEventList(jvm); // Test event class load is triggered and only once Class<? extends Event> clazz = initialize("jdk.jfr.jvm.HelloWorldEvent1"); // check that the event class is registered assertEventsIncluded(jvm, clazz); // second active use of the same event class should not add another class // to the list - it would already be loaded clazz = initialize(clazz); assertEventsIncluded(jvm, clazz); // second event class Class<? extends Event> clazz2 = initialize("jdk.jfr.jvm.HelloWorldEvent2"); // the list of event classes should now have two classes registered assertEventsIncluded(jvm, clazz, clazz2); // verify that an abstract event class is not included Class<? extends Event> abstractClass = initialize(MyAbstractEvent.class); // to run <clinit> assertEventsExcluded(jvm, abstractClass); // verify that a class that is yet to run its <clinit> is not included in the list of event classes assertEventsExcluded(jvm, MyUnInitializedEvent.class); // ensure old classes are not lost assertEventsIncluded(jvm, clazz, clazz2); jvm.destroyNativeJFR(); }
Example 2
Source File: TestGetEventWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); EventWriter writer = EventWriter.getEventWriter(); assertNotNull(writer, "EventWriter should not be null"); jvm.destroyNativeJFR(); }
Example 3
Source File: TestClassId.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { assertClassIds(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertClassIds(); jvm.destroyNativeJFR(); assertClassIds(); }
Example 4
Source File: TestBeginAndEnd.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); jvm.setFileNotification(MAX_CHUNK_SIZE); jvm.beginRecording(); jvm.endRecording(); jvm.destroyNativeJFR(); }
Example 5
Source File: TestCounterTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws InterruptedException { // Not enabled assertCounterTime(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertCounterTime(); // Enabled jvm.destroyNativeJFR(); }
Example 6
Source File: TestGetAllEventClasses.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws ClassNotFoundException { JVM jvm = JVM.getJVM(); // before creating native assertEmptyEventList(jvm); jvm.createNativeJFR(); // after creating native assertEmptyEventList(jvm); // Test event class load is triggered and only once Class<? extends Event> clazz = initialize("jdk.jfr.jvm.HelloWorldEvent1"); // check that the event class is registered assertEventsIncluded(jvm, clazz); // second active use of the same event class should not add another class // to the list - it would already be loaded clazz = initialize(clazz); assertEventsIncluded(jvm, clazz); // second event class Class<? extends Event> clazz2 = initialize("jdk.jfr.jvm.HelloWorldEvent2"); // the list of event classes should now have two classes registered assertEventsIncluded(jvm, clazz, clazz2); // verify that an abstract event class is not included Class<? extends Event> abstractClass = initialize(MyAbstractEvent.class); // to run <clinit> assertEventsExcluded(jvm, abstractClass); // verify that a class that is yet to run its <clinit> is not included in the list of event classes assertEventsExcluded(jvm, MyUnInitializedEvent.class); // ensure old classes are not lost assertEventsIncluded(jvm, clazz, clazz2); jvm.destroyNativeJFR(); }
Example 7
Source File: TestGetEventWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); EventWriter writer = EventWriter.getEventWriter(); assertNotNull(writer, "EventWriter should not be null"); jvm.destroyNativeJFR(); }
Example 8
Source File: TestClassId.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { assertClassIds(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertClassIds(); jvm.destroyNativeJFR(); assertClassIds(); }
Example 9
Source File: TestBeginAndEnd.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); jvm.setFileNotification(MAX_CHUNK_SIZE); jvm.beginRecording(); jvm.endRecording(); jvm.destroyNativeJFR(); }
Example 10
Source File: TestCounterTime.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws InterruptedException { // Not enabled assertCounterTime(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertCounterTime(); // Enabled jvm.destroyNativeJFR(); }
Example 11
Source File: TestGetAllEventClasses.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws ClassNotFoundException { JVM jvm = JVM.getJVM(); // before creating native assertEmptyEventList(jvm); jvm.createNativeJFR(); // after creating native assertEmptyEventList(jvm); // Test event class load is triggered and only once Class<? extends Event> clazz = initialize("jdk.jfr.jvm.HelloWorldEvent1"); // check that the event class is registered assertEventsIncluded(jvm, clazz); // second active use of the same event class should not add another class // to the list - it would already be loaded clazz = initialize(clazz); assertEventsIncluded(jvm, clazz); // second event class Class<? extends Event> clazz2 = initialize("jdk.jfr.jvm.HelloWorldEvent2"); // the list of event classes should now have two classes registered assertEventsIncluded(jvm, clazz, clazz2); // verify that an abstract event class is not included Class<? extends Event> abstractClass = initialize(MyAbstractEvent.class); // to run <clinit> assertEventsExcluded(jvm, abstractClass); // verify that a class that is yet to run its <clinit> is not included in the list of event classes assertEventsExcluded(jvm, MyUnInitializedEvent.class); // ensure old classes are not lost assertEventsIncluded(jvm, clazz, clazz2); jvm.destroyNativeJFR(); }
Example 12
Source File: TestGetEventWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); EventWriter writer = EventWriter.getEventWriter(); assertNotNull(writer, "EventWriter should not be null"); jvm.destroyNativeJFR(); }
Example 13
Source File: TestClassId.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { assertClassIds(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertClassIds(); jvm.destroyNativeJFR(); assertClassIds(); }
Example 14
Source File: TestBeginAndEnd.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) { JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); jvm.setFileNotification(MAX_CHUNK_SIZE); jvm.beginRecording(); jvm.endRecording(); jvm.destroyNativeJFR(); }
Example 15
Source File: TestCounterTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String... args) throws InterruptedException { // Not enabled assertCounterTime(); JVM jvm = JVM.getJVM(); jvm.createNativeJFR(); assertCounterTime(); // Enabled jvm.destroyNativeJFR(); }