Java Code Examples for jdk.jfr.consumer.RecordedEvent#hasField()
The following examples show how to use
jdk.jfr.consumer.RecordedEvent#hasField() .
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: TestFieldAccess.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void testHasField(RecordedEvent event) { System.out.println(event); Asserts.assertTrue(event.hasField("stringField")); Asserts.assertTrue(event.hasField("intField")); Asserts.assertTrue(event.hasField("longField")); Asserts.assertTrue(event.hasField("shortField")); Asserts.assertTrue(event.hasField("doubleField")); Asserts.assertTrue(event.hasField("floatField")); Asserts.assertTrue(event.hasField("threadField")); Asserts.assertTrue(event.hasField("classField")); Asserts.assertTrue(event.hasField("classField.name")); Asserts.assertTrue(event.hasField("eventThread")); Asserts.assertTrue(event.hasField("eventThread.group.name")); Asserts.assertTrue(event.hasField("startTime")); Asserts.assertTrue(event.hasField("stackTrace")); Asserts.assertTrue(event.hasField("duration")); Asserts.assertFalse(event.hasField("doesNotExist")); Asserts.assertFalse(event.hasField("classField.doesNotExist")); Asserts.assertFalse(event.hasField("")); try { event.hasField(null); } catch (NullPointerException npe) { // as expected } }
Example 2
Source File: IOEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static IOEvent createTestEvent(RecordedEvent event) { EventType eventType = getEventType(event); if (eventType == EventType.UnknownEvent) { return null; } EventField ev = Events.assertField(event, "eventThread"); RecordedThread t = ev.getValue(); String thread = t.getJavaName(); long size = 0L; if (isWriteEvent(eventType)) { size = Events.assertField(event, "bytesWritten").getValue(); } else if (isReadEvent(eventType)) { size = Events.assertField(event, "bytesRead").getValue(); } String address = getEventAddress(event); boolean endOfStream = false; if (event.hasField("endOfStream")) { endOfStream = event.getValue("endOfStream"); } if (event.hasField("endOfFile")) { endOfStream = event.getValue("endOfFile"); } return new IOEvent(thread, eventType, size, address, endOfStream); }
Example 3
Source File: IOEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static IOEvent createTestEvent(RecordedEvent event) { EventType eventType = getEventType(event); if (eventType == EventType.UnknownEvent) { return null; } EventField ev = Events.assertField(event, "eventThread"); RecordedThread t = ev.getValue(); String thread = t.getJavaName(); long size = 0L; if (isWriteEvent(eventType)) { size = Events.assertField(event, "bytesWritten").getValue(); } else if (isReadEvent(eventType)) { size = Events.assertField(event, "bytesRead").getValue(); } String address = getEventAddress(event); boolean endOfStream = false; if (event.hasField("endOfStream")) { endOfStream = event.getValue("endOfStream"); } if (event.hasField("endOfFile")) { endOfStream = event.getValue("endOfFile"); } return new IOEvent(thread, eventType, size, address, endOfStream); }
Example 4
Source File: TestFieldAccess.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void testHasField(RecordedEvent event) { System.out.println(event); Asserts.assertTrue(event.hasField("stringField")); Asserts.assertTrue(event.hasField("intField")); Asserts.assertTrue(event.hasField("longField")); Asserts.assertTrue(event.hasField("shortField")); Asserts.assertTrue(event.hasField("doubleField")); Asserts.assertTrue(event.hasField("floatField")); Asserts.assertTrue(event.hasField("threadField")); Asserts.assertTrue(event.hasField("classField")); Asserts.assertTrue(event.hasField("classField.name")); Asserts.assertTrue(event.hasField("eventThread")); Asserts.assertTrue(event.hasField("eventThread.group.name")); Asserts.assertTrue(event.hasField("startTime")); Asserts.assertTrue(event.hasField("stackTrace")); Asserts.assertTrue(event.hasField("duration")); Asserts.assertFalse(event.hasField("doesNotExist")); Asserts.assertFalse(event.hasField("classField.doesNotExist")); Asserts.assertFalse(event.hasField("")); try { event.hasField(null); } catch (NullPointerException npe) { // as expected } }
Example 5
Source File: IOEvent.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static IOEvent createTestEvent(RecordedEvent event) { EventType eventType = getEventType(event); if (eventType == EventType.UnknownEvent) { return null; } EventField ev = Events.assertField(event, "eventThread"); RecordedThread t = ev.getValue(); String thread = t.getJavaName(); long size = 0L; if (isWriteEvent(eventType)) { size = Events.assertField(event, "bytesWritten").getValue(); } else if (isReadEvent(eventType)) { size = Events.assertField(event, "bytesRead").getValue(); } String address = getEventAddress(event); boolean endOfStream = false; if (event.hasField("endOfStream")) { endOfStream = event.getValue("endOfStream"); } if (event.hasField("endOfFile")) { endOfStream = event.getValue("endOfFile"); } return new IOEvent(thread, eventType, size, address, endOfStream); }
Example 6
Source File: TestFieldAccess.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void testHasField(RecordedEvent event) { System.out.println(event); Asserts.assertTrue(event.hasField("stringField")); Asserts.assertTrue(event.hasField("intField")); Asserts.assertTrue(event.hasField("longField")); Asserts.assertTrue(event.hasField("shortField")); Asserts.assertTrue(event.hasField("doubleField")); Asserts.assertTrue(event.hasField("floatField")); Asserts.assertTrue(event.hasField("threadField")); Asserts.assertTrue(event.hasField("classField")); Asserts.assertTrue(event.hasField("classField.name")); Asserts.assertTrue(event.hasField("eventThread")); Asserts.assertTrue(event.hasField("eventThread.group.name")); Asserts.assertTrue(event.hasField("startTime")); Asserts.assertTrue(event.hasField("stackTrace")); Asserts.assertTrue(event.hasField("duration")); Asserts.assertFalse(event.hasField("doesNotExist")); Asserts.assertFalse(event.hasField("classField.doesNotExist")); Asserts.assertFalse(event.hasField("")); try { event.hasField(null); } catch (NullPointerException npe) { // as expected } }
Example 7
Source File: IOEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static IOEvent createTestEvent(RecordedEvent event) { EventType eventType = getEventType(event); if (eventType == EventType.UnknownEvent) { return null; } EventField ev = Events.assertField(event, "eventThread"); RecordedThread t = ev.getValue(); String thread = t.getJavaName(); long size = 0L; if (isWriteEvent(eventType)) { size = Events.assertField(event, "bytesWritten").getValue(); } else if (isReadEvent(eventType)) { size = Events.assertField(event, "bytesRead").getValue(); } String address = getEventAddress(event); boolean endOfStream = false; if (event.hasField("endOfStream")) { endOfStream = event.getValue("endOfStream"); } if (event.hasField("endOfFile")) { endOfStream = event.getValue("endOfFile"); } return new IOEvent(thread, eventType, size, address, endOfStream); }