Java Code Examples for jdk.jfr.internal.Utils#parseTimespan()

The following examples show how to use jdk.jfr.internal.Utils#parseTimespan() . 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: CutoffSetting.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static long parseValueSafe(String value) {
    if (value == null) {
        return 0L;
    }
    try {
        return isInfinity(value) ? Long.MAX_VALUE : Utils.parseTimespan(value);
    } catch (NumberFormatException nfe) {
        return 0L;
    }
}
 
Example 2
Source File: ThresholdSetting.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String combine(Set<String> values) {
    long min = Long.MAX_VALUE;
    String text = "0 ns";
    for (String value : values) {
        long l = Utils.parseTimespan(value);
        if (l < min) {
            text = value;
            min = l;
        }
    }
    return text;
}
 
Example 3
Source File: PeriodSetting.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String combine(Set<String> values) {
    long min = Long.MAX_VALUE;
    boolean beginChunk = false;
    boolean endChunk = false;
    String text = EVERY_CHUNK;
    for (String value : values) {
        switch (value) {
        case EVERY_CHUNK:
            beginChunk = true;
            endChunk = true;
            break;
        case BEGIN_CHUNK:
            beginChunk = true;
            break;
        case END_CHUNK:
            endChunk = true;
            break;
        default:
            long l = Utils.parseTimespan(value);
            if (l < min) {
                text = value;
                min = l;
            }
        }
    }
    if (min != Long.MAX_VALUE) {
        return text;
    }
    if (beginChunk && !endChunk) {
        return BEGIN_CHUNK;
    }
    if (!beginChunk && endChunk) {
        return END_CHUNK;
    }
    return text;
}
 
Example 4
Source File: ManagementSupport.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static long parseTimespan(String s) {
    return Utils.parseTimespan(s);
}
 
Example 5
Source File: CutoffSetting.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private long parseValue(String value) {
    return isInfinity(value) ? Long.MAX_VALUE : Utils.parseTimespan(value);
}
 
Example 6
Source File: ThresholdSetting.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setValue(String value) {
    long l = Utils.parseTimespan(value);
    this.value = value;
    eventType.setThreshold(l);
}
 
Example 7
Source File: ManagementSupport.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static long parseTimespan(String s) {
    return Utils.parseTimespan(s);
}
 
Example 8
Source File: ManagementSupport.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static long parseTimespan(String s) {
    return Utils.parseTimespan(s);
}