jdk.jfr.TransitionFrom Java Examples

The following examples show how to use jdk.jfr.TransitionFrom. 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: TestFieldAnnotations.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    EventType t = EventType.getEventType(FieldAnnotationEvent.class);

    ValueDescriptor field = t.getField("memoryAmount");
    Events.hasAnnotation(field, DataAmount.class);

    field = t.getField("frequency");
    Events.hasAnnotation(field, Frequency.class);

    field = t.getField("memoryAddress");
    Events.hasAnnotation(field, MemoryAddress.class);

    field = t.getField("percentage");
    Events.hasAnnotation(field, Percentage.class);

    field = t.getField("fromThread");
    Events.hasAnnotation(field, TransitionFrom.class);

    field = t.getField("toThread");
    Events.hasAnnotation(field, TransitionTo.class);

    field = t.getField("unsigned");
    Events.hasAnnotation(field, Unsigned.class);

    field = t.getField("timespan");
    Events.assertAnnotation(field, Timespan.class, Timespan.MILLISECONDS);

    field = t.getField("timestamp");
    Events.assertAnnotation(field, Timestamp.class, Timestamp.MILLISECONDS_SINCE_EPOCH);
}
 
Example #2
Source File: TestFieldAnnotations.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    EventType t = EventType.getEventType(FieldAnnotationEvent.class);

    ValueDescriptor field = t.getField("memoryAmount");
    Events.hasAnnotation(field, DataAmount.class);

    field = t.getField("frequency");
    Events.hasAnnotation(field, Frequency.class);

    field = t.getField("memoryAddress");
    Events.hasAnnotation(field, MemoryAddress.class);

    field = t.getField("percentage");
    Events.hasAnnotation(field, Percentage.class);

    field = t.getField("fromThread");
    Events.hasAnnotation(field, TransitionFrom.class);

    field = t.getField("toThread");
    Events.hasAnnotation(field, TransitionTo.class);

    field = t.getField("unsigned");
    Events.hasAnnotation(field, Unsigned.class);

    field = t.getField("timespan");
    Events.assertAnnotation(field, Timespan.class, Timespan.MILLISECONDS);

    field = t.getField("timestamp");
    Events.assertAnnotation(field, Timestamp.class, Timestamp.MILLISECONDS_SINCE_EPOCH);
}
 
Example #3
Source File: TestFieldAnnotations.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    EventType t = EventType.getEventType(FieldAnnotationEvent.class);

    ValueDescriptor field = t.getField("memoryAmount");
    Events.hasAnnotation(field, DataAmount.class);

    field = t.getField("frequency");
    Events.hasAnnotation(field, Frequency.class);

    field = t.getField("memoryAddress");
    Events.hasAnnotation(field, MemoryAddress.class);

    field = t.getField("percentage");
    Events.hasAnnotation(field, Percentage.class);

    field = t.getField("fromThread");
    Events.hasAnnotation(field, TransitionFrom.class);

    field = t.getField("toThread");
    Events.hasAnnotation(field, TransitionTo.class);

    field = t.getField("unsigned");
    Events.hasAnnotation(field, Unsigned.class);

    field = t.getField("timespan");
    Events.assertAnnotation(field, Timespan.class, Timespan.MILLISECONDS);

    field = t.getField("timestamp");
    Events.assertAnnotation(field, Timestamp.class, Timestamp.MILLISECONDS_SINCE_EPOCH);
}
 
Example #4
Source File: MetadataHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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 #5
Source File: MetadataHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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));
        }
    }
}