jdk.jfr.Frequency Java Examples

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

    SettingDescriptor plain = Events.getSetting(type, "plain");
    Asserts.assertNull(plain.getContentType());

    SettingDescriptor annotatedType = Events.getSetting(type, "annotatedType");
    Asserts.assertNull(annotatedType.getContentType(), Timestamp.class.getName());

    SettingDescriptor newName = Events.getSetting(type, "newName");
    Asserts.assertEquals(newName.getContentType(), Timespan.class.getName());

    SettingDescriptor overridden = Events.getSetting(type, "overridden");
    Asserts.assertNull(overridden.getContentType());

    SettingDescriptor protectedBase = Events.getSetting(type, "protectedBase");
    Asserts.assertEquals(protectedBase.getContentType(), Frequency.class);

    SettingDescriptor publicBase = Events.getSetting(type, "publicBase");
    Asserts.assertEquals(publicBase.getContentType(), Timestamp.class.getName());

    SettingDescriptor packageProtectedBase = Events.getSetting(type, "packageProtectedBase");
    Asserts.assertNull(packageProtectedBase.getContentType());

    CustomEvent.assertOnDisk((x, y) -> Objects.equals(x.getContentType(), y.getContentType()) ? 0 : 1);
}
 
Example #2
Source File: TestGetContentType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    EventType type = EventType.getEventType(CustomEvent.class);

    SettingDescriptor plain = Events.getSetting(type, "plain");
    Asserts.assertNull(plain.getContentType());

    SettingDescriptor annotatedType = Events.getSetting(type, "annotatedType");
    Asserts.assertNull(annotatedType.getContentType(), Timestamp.class.getName());

    SettingDescriptor newName = Events.getSetting(type, "newName");
    Asserts.assertEquals(newName.getContentType(), Timespan.class.getName());

    SettingDescriptor overridden = Events.getSetting(type, "overridden");
    Asserts.assertNull(overridden.getContentType());

    SettingDescriptor protectedBase = Events.getSetting(type, "protectedBase");
    Asserts.assertEquals(protectedBase.getContentType(), Frequency.class);

    SettingDescriptor publicBase = Events.getSetting(type, "publicBase");
    Asserts.assertEquals(publicBase.getContentType(), Timestamp.class.getName());

    SettingDescriptor packageProtectedBase = Events.getSetting(type, "packageProtectedBase");
    Asserts.assertNull(packageProtectedBase.getContentType());

    CustomEvent.assertOnDisk((x, y) -> Objects.equals(x.getContentType(), y.getContentType()) ? 0 : 1);
}
 
Example #3
Source File: TestGetContentType.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    EventType type = EventType.getEventType(CustomEvent.class);

    SettingDescriptor plain = Events.getSetting(type, "plain");
    Asserts.assertNull(plain.getContentType());

    SettingDescriptor annotatedType = Events.getSetting(type, "annotatedType");
    Asserts.assertNull(annotatedType.getContentType(), Timestamp.class.getName());

    SettingDescriptor newName = Events.getSetting(type, "newName");
    Asserts.assertEquals(newName.getContentType(), Timespan.class.getName());

    SettingDescriptor overridden = Events.getSetting(type, "overridden");
    Asserts.assertNull(overridden.getContentType());

    SettingDescriptor protectedBase = Events.getSetting(type, "protectedBase");
    Asserts.assertEquals(protectedBase.getContentType(), Frequency.class);

    SettingDescriptor publicBase = Events.getSetting(type, "publicBase");
    Asserts.assertEquals(publicBase.getContentType(), Timestamp.class.getName());

    SettingDescriptor packageProtectedBase = Events.getSetting(type, "packageProtectedBase");
    Asserts.assertNull(packageProtectedBase.getContentType());

    CustomEvent.assertOnDisk((x, y) -> Objects.equals(x.getContentType(), y.getContentType()) ? 0 : 1);
}
 
Example #4
Source File: BaseEvent.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@SettingDefinition
@Name("protectedBase")
@Label("Protected Base")
@Description("Description of protected base")
@Frequency
protected boolean something(PlainSetting control) {
    return true;
}
 
Example #5
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 #6
Source File: BaseEvent.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@SettingDefinition
@Name("protectedBase")
@Label("Protected Base")
@Description("Description of protected base")
@Frequency
protected boolean something(PlainSetting control) {
    return true;
}
 
Example #7
Source File: BaseEvent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@SettingDefinition
@Name("protectedBase")
@Label("Protected Base")
@Description("Description of protected base")
@Frequency
protected boolean something(PlainSetting control) {
    return true;
}
 
Example #8
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 #9
Source File: BaseEvent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@SettingDefinition
@Name("protectedBase")
@Label("Protected Base")
@Description("Description of protected base")
@Frequency
protected boolean something(PlainSetting control) {
    return true;
}
 
Example #10
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 #11
Source File: DisplayableSupport.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
@Override
Class<Frequency> getType() {
    return Frequency.class;
}
 
Example #12
Source File: DisplayableSupport.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
@Override
Format createFormat(ValueDescriptor descriptor, Frequency annotation) {
    FormatProcessor dataAmountProcessor = FORMAT_PROCESSORS[FORMAT_PROCESSORS.length - 1];
    Annotation dataAmountAnnotation = descriptor.getAnnotation(dataAmountProcessor.getType());
    return new FrequencyFormat(dataAmountAnnotation == null ? null : dataAmountProcessor.createFormat(descriptor, dataAmountAnnotation));
}