jdk.jfr.Experimental Java Examples
The following examples show how to use
jdk.jfr.Experimental.
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: TestExperimental.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { EventType t = EventType.getEventType(ExperimentalEvent.class); // @Experimental on event Experimental e = t.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental annotation on event"); // @Experimental on annotation AnnotationElement a = Events.getAnnotationByName(t, ExperimentalAnnotation.class.getName()); e = a.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on annotation"); // @Experimental on field a = Events.getAnnotation(t.getField("experimentalField"), Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on field"); }
Example #2
Source File: TestExperimental.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { EventType t = EventType.getEventType(ExperimentalEvent.class); // @Experimental on event Experimental e = t.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental annotation on event"); // @Experimental on annotation AnnotationElement a = Events.getAnnotationByName(t, ExperimentalAnnotation.class.getName()); e = a.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on annotation"); // @Experimental on field a = Events.getAnnotation(t.getField("experimentalField"), Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on field"); }
Example #3
Source File: TestExperimental.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { EventType t = EventType.getEventType(ExperimentalEvent.class); // @Experimental on event Experimental e = t.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental annotation on event"); // @Experimental on annotation AnnotationElement a = Events.getAnnotationByName(t, ExperimentalAnnotation.class.getName()); e = a.getAnnotation(Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on annotation"); // @Experimental on field a = Events.getAnnotation(t.getField("experimentalField"), Experimental.class); Asserts.assertTrue(e != null, "Expected @Experimental on field"); }
Example #4
Source File: TestLookForUntestedEvents.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { for (EventType type : FlightRecorder.getFlightRecorder().getEventTypes()) { if (type.getAnnotation(Experimental.class) == null) { jfrEventTypes.add(type.getName().replace("jdk.", "")); } } checkEventNamesClass(); lookForEventsNotCoveredByTests(); }
Example #5
Source File: TestLookForUntestedEvents.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { for (EventType type : FlightRecorder.getFlightRecorder().getEventTypes()) { if (type.getAnnotation(Experimental.class) == null) { jfrEventTypes.add(type.getName().replace("jdk.", "")); } } checkEventNamesClass(); lookForEventsNotCoveredByTests(); }
Example #6
Source File: TraceHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case ELEMENT_RELATION_DECL: String relationalURI = attributes.getValue(ATTRIBUTE_URI); String id = attributes.getValue(ATTRIBUTE_ID); typedef.put(id, relationalURI); break; case ELEMENT_PRIMARY_TYPE: addTypedef(attributes); break; case ELEMENT_STRUCT_ARRAY: valueDeclarations.add(new ValueDeclaration(type, 1, attributes)); break; case ELEMENT_VALUE: case ELEMENT_STRUCT_VALUE: valueDeclarations.add(new ValueDeclaration(type, 0, attributes)); break; case ELEMENT_EVENT: type = createType(attributes, true, structTypeId++, false); boolean stackTrace = getBoolean(attributes, ATTRIBUTE_HAS_STACKTRACE); boolean thread = getBoolean(attributes, (ATTRIBUTE_HAS_THREAD)); boolean instant = getBoolean(attributes, (ATTRIBUTE_IS_INSTANT)); boolean requestable = getBoolean(attributes, (ATTRIBUTE_IS_REQUESTABLE)); boolean constant = getBoolean(attributes, (ATTRIBUTE_IS_CONSTANT)); boolean duration = !requestable && !instant; boolean experimental = getBoolean(attributes, ATTRIBUTE_EXPERIMENTAL); boolean cutoff = getBoolean(attributes, ATTRIBUTE_CUTOFF); TypeLibrary.addImplicitFields(type, requestable, duration, thread, stackTrace, cutoff); ArrayList<AnnotationElement> aes = new ArrayList<>(); aes.addAll(type.getAnnotationElements()); if (requestable) { String period = constant ? "endChunk" : "everyChunk"; aes.add(new AnnotationElement(Period.class, period)); } else { if (!instant) { aes.add(new AnnotationElement(Threshold.class, "0 ns")); } if (stackTrace) { aes.add(new AnnotationElement(StackTrace.class, true)); } } if (cutoff) { aes.add(new AnnotationElement(Cutoff.class, Cutoff.INIFITY)); } if (experimental) { aes.add(new AnnotationElement(Experimental.class)); } aes.add(new AnnotationElement(Enabled.class, false)); aes.trimToSize(); type.setAnnotations(aes); break; case ELEMENT_CONTENT_TYPE: if (attributes.getValue(ATTRIBUTE_BUILTIN_TYPE) != null) { type = createType(attributes, false, builtInId(attributes), true); } else { type = createType(attributes, false, jvmTypeId++, true); } break; case ELEMENT_STRUCT_TYPE: case ELEMENT_STRUCT: type = createType(attributes, false, structTypeId++, false); break; } }
Example #7
Source File: MetadataHandler.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void addFields(Map<String, Type> lookup, Map<String, AnnotationElement> relationMap) { for (TypeElement te : types.values()) { Type type = lookup.get(te.name); if (te.isEvent) { boolean periodic = te.period!= null; TypeLibrary.addImplicitFields(type, periodic, te.startTime && !periodic, te.thread, te.stackTrace && !periodic, te.cutoff); } for (FieldElement f : te.fields) { Type fieldType = Type.getKnownType(f.typeName); if (fieldType == null) { fieldType = Objects.requireNonNull(lookup.get(f.referenceType.name)); } List<AnnotationElement> aes = new ArrayList<>(); if (f.unsigned) { aes.add(new AnnotationElement(Unsigned.class)); } if (f.contentType != null) { aes.addAll(Objects.requireNonNull(xmlContentTypes.get(f.contentType))); } if (f.relation != null) { aes.add(Objects.requireNonNull(relationMap.get(f.relation))); } if (f.label != null) { aes.add(new AnnotationElement(Label.class, f.label)); } if (f.experimental) { aes.add(new AnnotationElement(Experimental.class)); } if (f.description != null) { aes.add(new AnnotationElement(Description.class, f.description)); } if ("from".equals(f.transition)) { aes.add(new AnnotationElement(TransitionFrom.class)); } if ("to".equals(f.transition)) { aes.add(new AnnotationElement(TransitionTo.class)); } boolean constantPool = !f.struct && f.referenceType != null; type.add(PrivateAccess.getInstance().newValueDescriptor(f.name, fieldType, aes, f.array ? 1 : 0, constantPool, null)); } } }
Example #8
Source File: MetadataHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void addFields(Map<String, Type> lookup, Map<String, AnnotationElement> relationMap) { for (TypeElement te : types.values()) { Type type = lookup.get(te.name); if (te.isEvent) { boolean periodic = te.period!= null; TypeLibrary.addImplicitFields(type, periodic, te.startTime && !periodic, te.thread, te.stackTrace && !periodic, te.cutoff); } for (FieldElement f : te.fields) { Type fieldType = Type.getKnownType(f.typeName); if (fieldType == null) { fieldType = Objects.requireNonNull(lookup.get(f.referenceType.name)); } List<AnnotationElement> aes = new ArrayList<>(); if (f.unsigned) { aes.add(new AnnotationElement(Unsigned.class)); } if (f.contentType != null) { aes.addAll(Objects.requireNonNull(xmlContentTypes.get(f.contentType))); } if (f.relation != null) { aes.add(Objects.requireNonNull(relationMap.get(f.relation))); } if (f.label != null) { aes.add(new AnnotationElement(Label.class, f.label)); } if (f.experimental) { aes.add(new AnnotationElement(Experimental.class)); } if (f.description != null) { aes.add(new AnnotationElement(Description.class, f.description)); } if ("from".equals(f.transition)) { aes.add(new AnnotationElement(TransitionFrom.class)); } if ("to".equals(f.transition)) { aes.add(new AnnotationElement(TransitionTo.class)); } boolean constantPool = !f.struct && f.referenceType != null; type.add(PrivateAccess.getInstance().newValueDescriptor(f.name, fieldType, aes, f.array ? 1 : 0, constantPool, null)); } } }
Example #9
Source File: DisplayableSupport.java From visualvm with GNU General Public License v2.0 | 4 votes |
private static boolean isExperimental(ValueDescriptor descriptor) { return descriptor.getAnnotation(Experimental.class) != null; }
Example #10
Source File: JFRJDK9EventType.java From visualvm with GNU General Public License v2.0 | 4 votes |
@Override public boolean isExperimental() { return type.getAnnotation(Experimental.class) != null; }