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

The following examples show how to use jdk.jfr.Recording#getDestination() . 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: 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 2
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 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: Events.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    int pid = 0;
    try {
        pid = ProcessTools.getProcessId();
    } catch (Exception e) {
        //do nothing, let's use 0
    }

    if (p == null) {
        File directory = new File(".");
        // FIXME: Must come up with a way to give human-readable name
        // this will at least not clash when running parallel.
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + pid + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}
 
Example 5
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 6
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 7
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 8
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());
}
 
Example 9
Source File: MainTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    if (p == null) {
        File directory = new File(".");
        ProcessHandle h = ProcessHandle.current();
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}
 
Example 10
Source File: MainTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    if (p == null) {
        File directory = new File(".");
        ProcessHandle h = ProcessHandle.current();
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}
 
Example 11
Source File: Events.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    if (p == null) {
        File directory = new File(".");
        // FIXME: Must come up with a way to give human-readable name
        // this will at least not clash when running parallel.
        //ProcessHandle h = ProcessHandle.current();
        //p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + getProcessId("666") + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}
 
Example 12
Source File: MainTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    if (p == null) {
        File directory = new File(".");
        ProcessHandle h = ProcessHandle.current();
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}
 
Example 13
Source File: Events.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Path makeCopy(Recording recording) throws IOException {
    Path p = recording.getDestination();
    if (p == null) {
        File directory = new File(".");
        // FIXME: Must come up with a way to give human-readable name
        // this will at least not clash when running parallel.
        //ProcessHandle h = ProcessHandle.current();
        //p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
        p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + getProcessId("666") + ".jfr").toPath();
        recording.dump(p);
    }
    return p;
}