Java Code Examples for jdk.jfr.Recording#getDuration()

The following examples show how to use jdk.jfr.Recording#getDuration() . 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: DCmdCheck.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void printGeneral(Recording recording) {
    String format = "Recording: recording=%d name=\"%s\"";
    print(format, recording.getId(), recording.getName());

    Duration duration = recording.getDuration();
    if (duration != null) {
        print(" duration=");
        printTimespan(duration, "");
    }

    long maxSize = recording.getMaxSize();
    if (maxSize != 0) {
        print(" maxsize=");
        printBytes(maxSize, "");
    }
    Duration maxAge = recording.getMaxAge();
    if (maxAge != null) {
        print(" maxage=");
        printTimespan(maxAge, "");
    }

    print(" (" + recording.getState().toString().toLowerCase() + ")");
    println();
}
 
Example 2
Source File: RecordingInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
RecordingInfo(Recording recording) {
    id = recording.getId();
    name = recording.getName();
    state = recording.getState().toString();
    dumpOnExit = recording.getDumpOnExit();
    size = recording.getSize();
    disk = recording.isToDisk();

    Duration d = recording.getMaxAge();
    if (d == null) {
        maxAge = 0;
    } else {
        maxAge = d.getSeconds();
    }
    maxSize = recording.getMaxSize();
    Instant s = recording.getStartTime();
    startTime = s == null ? 0L : s.toEpochMilli();
    Instant st = recording.getStopTime();
    stopTime = st == null ? 0L : st.toEpochMilli();
    Path p = recording.getDestination();
    destination = p == null ? null : p.toString();
    Duration duration = recording.getDuration();
    durationInSeconds = duration == null ? 0 : duration.getSeconds();
    settings = recording.getSettings();
}
 
Example 3
Source File: JmxHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void verifyEquals(RecordingInfo ri, Recording r) {
    String destination = r.getDestination() != null ? r.getDestination().toString() : null;
    long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0;
    long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0;

    Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination");
    Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit");
    Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration");
    Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id");
    Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge");
    Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize");
    Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name");
    Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size");
    Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime");
    Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state");
    Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime");

    verifyMapEquals(r.getSettings(), ri.getSettings());
}
 
Example 4
Source File: JmxHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void verifyEquals(RecordingInfo ri, Recording r) {
    String destination = r.getDestination() != null ? r.getDestination().toString() : null;
    long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0;
    long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0;

    Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination");
    Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit");
    Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration");
    Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id");
    Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge");
    Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize");
    Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name");
    Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size");
    Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime");
    Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state");
    Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime");

    verifyMapEquals(r.getSettings(), ri.getSettings());
}
 
Example 5
Source File: DCmdCheck.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void printGeneral(Recording recording) {
    print("Recording " + recording.getId() + ": name=" + recording.getName());

    Duration duration = recording.getDuration();
    if (duration != null) {
        print(" duration=");
        printTimespan(duration, "");
    }

    long maxSize = recording.getMaxSize();
    if (maxSize != 0) {
        print(" maxsize=");
        print(Utils.formatBytesCompact(maxSize));
    }
    Duration maxAge = recording.getMaxAge();
    if (maxAge != null) {
        print(" maxage=");
        printTimespan(maxAge, "");
    }

    print(" (" + recording.getState().toString().toLowerCase() + ")");
    println();
}
 
Example 6
Source File: RecordingInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
RecordingInfo(Recording recording) {
    id = recording.getId();
    name = recording.getName();
    state = recording.getState().toString();
    dumpOnExit = recording.getDumpOnExit();
    size = recording.getSize();
    disk = recording.isToDisk();

    Duration d = recording.getMaxAge();
    if (d == null) {
        maxAge = 0;
    } else {
        maxAge = d.getSeconds();
    }
    maxSize = recording.getMaxSize();
    Instant s = recording.getStartTime();
    startTime = s == null ? 0L : s.toEpochMilli();
    Instant st = recording.getStopTime();
    stopTime = st == null ? 0L : st.toEpochMilli();
    Path p = recording.getDestination();
    destination = p == null ? null : p.toString();
    Duration duration = recording.getDuration();
    durationInSeconds = duration == null ? 0 : duration.getSeconds();
    settings = recording.getSettings();
}
 
Example 7
Source File: JmxHelper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void verifyEquals(RecordingInfo ri, Recording r) {
    String destination = r.getDestination() != null ? r.getDestination().toString() : null;
    long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0;
    long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0;

    Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination");
    Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit");
    Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration");
    Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id");
    Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge");
    Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize");
    Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name");
    Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size");
    Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime");
    Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state");
    Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime");

    verifyMapEquals(r.getSettings(), ri.getSettings());
}
 
Example 8
Source File: DCmdCheck.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void printGeneral(Recording recording) {
    print("Recording " + recording.getId() + ": name=" + recording.getName());

    Duration duration = recording.getDuration();
    if (duration != null) {
        print(" duration=");
        printTimespan(duration, "");
    }

    long maxSize = recording.getMaxSize();
    if (maxSize != 0) {
        print(" maxsize=");
        print(Utils.formatBytesCompact(maxSize));
    }
    Duration maxAge = recording.getMaxAge();
    if (maxAge != null) {
        print(" maxage=");
        printTimespan(maxAge, "");
    }

    print(" (" + recording.getState().toString().toLowerCase() + ")");
    println();
}
 
Example 9
Source File: RecordingInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
RecordingInfo(Recording recording) {
    id = recording.getId();
    name = recording.getName();
    state = recording.getState().toString();
    dumpOnExit = recording.getDumpOnExit();
    size = recording.getSize();
    disk = recording.isToDisk();

    Duration d = recording.getMaxAge();
    if (d == null) {
        maxAge = 0;
    } else {
        maxAge = d.getSeconds();
    }
    maxSize = recording.getMaxSize();
    Instant s = recording.getStartTime();
    startTime = s == null ? 0L : s.toEpochMilli();
    Instant st = recording.getStopTime();
    stopTime = st == null ? 0L : st.toEpochMilli();
    Path p = recording.getDestination();
    destination = p == null ? null : p.toString();
    Duration duration = recording.getDuration();
    durationInSeconds = duration == null ? 0 : duration.getSeconds();
    settings = recording.getSettings();
}
 
Example 10
Source File: JmxHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void verifyEquals(RecordingInfo ri, Recording r) {
    String destination = r.getDestination() != null ? r.getDestination().toString() : null;
    long maxAge = r.getMaxAge() != null ? r.getMaxAge().getSeconds() : 0;
    long duration = r.getDuration() != null ? r.getDuration().getSeconds() : 0;

    Asserts.assertEquals(destination, ri.getDestination(), "Wrong destination");
    Asserts.assertEquals(r.getDumpOnExit(), ri.getDumpOnExit(), "Wrong dumpOnExit");
    Asserts.assertEquals(duration, ri.getDuration(), "Wrong duration");
    Asserts.assertEquals(r.getId(), ri.getId(), "Wrong id");
    Asserts.assertEquals(maxAge, ri.getMaxAge(), "Wrong maxAge");
    Asserts.assertEquals(r.getMaxSize(), ri.getMaxSize(), "Wrong maxSize");
    Asserts.assertEquals(r.getName(), ri.getName(), "Wrong name");
    Asserts.assertEquals(r.getSize(), ri.getSize(), "Wrong size");
    Asserts.assertEquals(toEpochMillis(r.getStartTime()), ri.getStartTime(), "Wrong startTime");
    Asserts.assertEquals(r.getState().toString(), ri.getState(), "Wrong state");
    Asserts.assertEquals(toEpochMillis(r.getStopTime()), ri.getStopTime(), "Wrong stopTime");

    verifyMapEquals(r.getSettings(), ri.getSettings());
}