Search in sources :

Example 1 with JStatLogger

use of sun.tools.jstat.JStatLogger in project jdk8u_jdk by JetBrains.

the class JCmd method listCounters.

private static void listCounters(String pid) {
    // Code from JStat (can't call it directly since it does System.exit)
    VmIdentifier vmId = null;
    try {
        vmId = new VmIdentifier(pid);
    } catch (URISyntaxException e) {
        System.err.println("Malformed VM Identifier: " + pid);
        return;
    }
    try {
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        JStatLogger logger = new JStatLogger(monitoredVm);
        // all names
        logger.printSnapShot(// all names
        "\\w*", // comparator
        new AscendingMonitorComparator(), // not verbose
        false, // show unsupported
        true, System.out);
        monitoredHost.detach(monitoredVm);
    } catch (MonitorException ex) {
        ex.printStackTrace();
    }
}
Also used : JStatLogger(sun.tools.jstat.JStatLogger) MonitoredVm(sun.jvmstat.monitor.MonitoredVm) VmIdentifier(sun.jvmstat.monitor.VmIdentifier) URISyntaxException(java.net.URISyntaxException) MonitoredHost(sun.jvmstat.monitor.MonitoredHost) MonitorException(sun.jvmstat.monitor.MonitorException)

Aggregations

URISyntaxException (java.net.URISyntaxException)1 MonitorException (sun.jvmstat.monitor.MonitorException)1 MonitoredHost (sun.jvmstat.monitor.MonitoredHost)1 MonitoredVm (sun.jvmstat.monitor.MonitoredVm)1 VmIdentifier (sun.jvmstat.monitor.VmIdentifier)1 JStatLogger (sun.tools.jstat.JStatLogger)1