jdk.management.jfr.EventTypeInfo Java Examples
The following examples show how to use
jdk.management.jfr.EventTypeInfo.
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: TestEventTypes.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void assertSame(List<EventTypeInfo> infos, List<EventType> types) { List<Long> ids = new ArrayList<>(); for (EventTypeInfo info : infos) { long id = info.getId(); Asserts.assertFalse(ids.contains(id), "EventTypeInfo.id not unique:" + id); ids.add(id); boolean isFound = false; for (EventType type : types) { if (type.getId() == id) { assertSame(info, type); isFound = true; break; } } if (!isFound) { String msg = "No EventType for EventTypeInfo"; System.out.println(msg + ": " + info); Asserts.fail(msg); } } Asserts.assertEquals(infos.size(), types.size(), "Number of EventTypeInfos != EventTypes"); }
Example #2
Source File: TestStartRecording.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(); long recId = bean.newRecording(); bean.startRecording(recId); // TODO: Remove debug logs List<ConfigurationInfo> configs = bean.getConfigurations(); for (ConfigurationInfo config : configs) { System.out.println("config=" + config.toString()); } Map<String, String> settings = bean.getRecordingSettings(recId); for (String key : settings.keySet()) { System.out.println("setting: " + key + "=" + settings.get(key)); } List<EventTypeInfo> types = bean.getEventTypes(); for (EventTypeInfo type : types) { System.out.println("type=" + type.getName()); } ////////////////////// bean.stopRecording(recId); bean.closeRecording(recId); }
Example #3
Source File: TestEventTypes.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void assertSame(List<EventTypeInfo> infos, List<EventType> types) { List<Long> ids = new ArrayList<>(); for (EventTypeInfo info : infos) { long id = info.getId(); Asserts.assertFalse(ids.contains(id), "EventTypeInfo.id not unique:" + id); ids.add(id); boolean isFound = false; for (EventType type : types) { if (type.getId() == id) { assertSame(info, type); isFound = true; break; } } if (!isFound) { String msg = "No EventType for EventTypeInfo"; System.out.println(msg + ": " + info); Asserts.fail(msg); } } Asserts.assertEquals(infos.size(), types.size(), "Number of EventTypeInfos != EventTypes"); }
Example #4
Source File: TestStartRecording.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(); long recId = bean.newRecording(); bean.startRecording(recId); // TODO: Remove debug logs List<ConfigurationInfo> configs = bean.getConfigurations(); for (ConfigurationInfo config : configs) { System.out.println("config=" + config.toString()); } Map<String, String> settings = bean.getRecordingSettings(recId); for (String key : settings.keySet()) { System.out.println("setting: " + key + "=" + settings.get(key)); } List<EventTypeInfo> types = bean.getEventTypes(); for (EventTypeInfo type : types) { System.out.println("type=" + type.getName()); } ////////////////////// bean.stopRecording(recId); bean.closeRecording(recId); }
Example #5
Source File: TestEventTypes.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void assertSame(List<EventTypeInfo> infos, List<EventType> types) { List<Long> ids = new ArrayList<>(); for (EventTypeInfo info : infos) { long id = info.getId(); Asserts.assertFalse(ids.contains(id), "EventTypeInfo.id not unique:" + id); ids.add(id); boolean isFound = false; for (EventType type : types) { if (type.getId() == id) { assertSame(info, type); isFound = true; break; } } if (!isFound) { String msg = "No EventType for EventTypeInfo"; System.out.println(msg + ": " + info); Asserts.fail(msg); } } Asserts.assertEquals(infos.size(), types.size(), "Number of EventTypeInfos != EventTypes"); }
Example #6
Source File: TestStartRecording.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(); long recId = bean.newRecording(); bean.startRecording(recId); // TODO: Remove debug logs List<ConfigurationInfo> configs = bean.getConfigurations(); for (ConfigurationInfo config : configs) { System.out.println("config=" + config.toString()); } Map<String, String> settings = bean.getRecordingSettings(recId); for (String key : settings.keySet()) { System.out.println("setting: " + key + "=" + settings.get(key)); } List<EventTypeInfo> types = bean.getEventTypes(); for (EventTypeInfo type : types) { System.out.println("type=" + type.getName()); } ////////////////////// bean.stopRecording(recId); bean.closeRecording(recId); }
Example #7
Source File: TestEventTypes.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean(); FlightRecorder jfr = FlightRecorder.getFlightRecorder(); Recording r = new Recording(); r.enable(MyEvent.class); new MyEvent(); // triggers <clinit> List<EventTypeInfo> infos = bean.getEventTypes(); List<EventType> types = jfr.getEventTypes(); Asserts.assertFalse(infos.isEmpty(), "No EventTypeInfos found"); verifyMyEventType(infos); assertSame(infos, types); r.close(); }
Example #8
Source File: TestEventTypes.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void verifyMyEventType(List<EventTypeInfo> infos) { for (EventTypeInfo info : infos) { if ("MyEvent.name".equals(info.getName())) { System.out.println("EventTypeInfo for MyEvent: " + info); Asserts.assertEquals("MyEvent.label", info.getLabel()); Asserts.assertEquals("MyEvent.description", info.getDescription()); for (SettingDescriptorInfo si : info.getSettingDescriptors()) { System.out.println("si=" + si); } return; } } Asserts.fail("Missing EventTypeInfo for MyEvent"); }
Example #9
Source File: TestEventTypes.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSame(EventTypeInfo ti, EventType t) { try { Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id"); Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name"); Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label"); Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description"); Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names"); for (SettingDescriptorInfo si : ti.getSettingDescriptors()) { String settingName = si.getName(); boolean isFound = false; for (SettingDescriptor d : t.getSettingDescriptors()) { if (settingName.equals(d.getName())) { assertSame(si, d, t); isFound = true; break; } } if (!isFound) { Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si); } } } catch (Exception e) { System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t); throw e; } }
Example #10
Source File: TestEventTypes.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(); FlightRecorder jfr = FlightRecorder.getFlightRecorder(); Recording r = new Recording(); r.enable(MyEvent.class); new MyEvent(); // triggers <clinit> List<EventTypeInfo> infos = bean.getEventTypes(); List<EventType> types = jfr.getEventTypes(); Asserts.assertFalse(infos.isEmpty(), "No EventTypeInfos found"); verifyMyEventType(infos); assertSame(infos, types); r.close(); }
Example #11
Source File: TestEventTypes.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void verifyMyEventType(List<EventTypeInfo> infos) { for (EventTypeInfo info : infos) { if ("MyEvent.name".equals(info.getName())) { System.out.println("EventTypeInfo for MyEvent: " + info); Asserts.assertEquals("MyEvent.label", info.getLabel()); Asserts.assertEquals("MyEvent.description", info.getDescription()); for (SettingDescriptorInfo si : info.getSettingDescriptors()) { System.out.println("si=" + si); } return; } } Asserts.fail("Missing EventTypeInfo for MyEvent"); }
Example #12
Source File: TestEventTypes.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void assertSame(EventTypeInfo ti, EventType t) { try { Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id"); Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name"); Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label"); Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description"); Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names"); for (SettingDescriptorInfo si : ti.getSettingDescriptors()) { String settingName = si.getName(); boolean isFound = false; for (SettingDescriptor d : t.getSettingDescriptors()) { if (settingName.equals(d.getName())) { assertSame(si, d, t); isFound = true; break; } } if (!isFound) { Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si); } } } catch (Exception e) { System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t); throw e; } }
Example #13
Source File: TestEventTypes.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(); FlightRecorder jfr = FlightRecorder.getFlightRecorder(); Recording r = new Recording(); r.enable(MyEvent.class); new MyEvent(); // triggers <clinit> List<EventTypeInfo> infos = bean.getEventTypes(); List<EventType> types = jfr.getEventTypes(); Asserts.assertFalse(infos.isEmpty(), "No EventTypeInfos found"); verifyMyEventType(infos); assertSame(infos, types); r.close(); }
Example #14
Source File: TestEventTypes.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void verifyMyEventType(List<EventTypeInfo> infos) { for (EventTypeInfo info : infos) { if ("MyEvent.name".equals(info.getName())) { System.out.println("EventTypeInfo for MyEvent: " + info); Asserts.assertEquals("MyEvent.label", info.getLabel()); Asserts.assertEquals("MyEvent.description", info.getDescription()); for (SettingDescriptorInfo si : info.getSettingDescriptors()) { System.out.println("si=" + si); } return; } } Asserts.fail("Missing EventTypeInfo for MyEvent"); }
Example #15
Source File: TestEventTypes.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void assertSame(EventTypeInfo ti, EventType t) { try { Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id"); Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name"); Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label"); Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description"); Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names"); for (SettingDescriptorInfo si : ti.getSettingDescriptors()) { String settingName = si.getName(); boolean isFound = false; for (SettingDescriptor d : t.getSettingDescriptors()) { if (settingName.equals(d.getName())) { assertSame(si, d, t); isFound = true; break; } } if (!isFound) { Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si); } } } catch (Exception e) { System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t); throw e; } }