Java Code Examples for sun.management.counter.Counter#getName()

The following examples show how to use sun.management.counter.Counter#getName() . 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: ConnectorAddressLink.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 2
Source File: ConnectorAddressLink.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 3
Source File: ConnectorAddressLink.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 4
Source File: ConnectorAddressLink.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 5
Source File: ConnectorAddressLink.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 6
Source File: ConnectorAddressLink.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 7
Source File: ConnectorAddressLink.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 8
Source File: ConnectorAddressLink.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 9
Source File: ConnectorAddressLink.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 10
Source File: ConnectorAddressLink.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 11
Source File: ConnectorAddressLink.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 12
Source File: ConnectorAddressLink.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 13
Source File: ConnectorAddressLink.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Imports the remote connector address and associated
 * configuration properties from the instrument buffer
 * of the specified Java virtual machine.
 *
 * @param vmid an identifier that uniquely identifies a local Java virtual
 * machine, or <code>0</code> to indicate the current Java virtual machine.
 *
 * @return a map containing the remote connector's properties, or an empty
 * map if the target VM has not exported the remote connector's properties.
 *
 * @throws IOException An I/O error occurred while trying to acquire the
 * instrumentation buffer.
 */
public static Map<String, String> importRemoteFrom(int vmid) throws IOException {
    Perf perf = Perf.getPerf();
    ByteBuffer bb;
    try {
        bb = perf.attach(vmid, "r");
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae.getMessage());
    }
    List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
    Map<String, String> properties = new HashMap<>();
    for (Counter c : counters) {
        String name =  c.getName();
        if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
            properties.put(name, c.getValue().toString());
        }
    }
    return properties;
}
 
Example 14
Source File: SynchronizationStatistics.java    From garmadon with Apache License 2.0 5 votes vote down vote up
SynchronizationStatistics(HotspotRuntimeMBean hsRuntime) {
    super(SYNCLOCKS_HEADER);
    this.hsRuntime = hsRuntime;
    int countOfCounters = 0;
    for (Counter counter : hsRuntime.getInternalRuntimeCounters()) {
        String counterName = counter.getName();
        if (this.counters.contains(counterName)) countOfCounters++;
    }
    if (countOfCounters == 0) throw new RuntimeException("No sync locks counters found");
}
 
Example 15
Source File: SynchronizationStatistics.java    From garmadon with Apache License 2.0 5 votes vote down vote up
@Override
protected void innerCollect(StatisticsSink sink) {
    for (Counter counter : hsRuntime.getInternalRuntimeCounters()) {
        String counterName = counter.getName();
        if (counters.contains(counterName)) {
            counterName = counterName.substring("sun.rt._sync_".length()).toLowerCase();
            Object value = counter.getValue();
            sink.add(counterName, value.toString());
        }
    }
}