sun.jvmstat.monitor.Monitor Java Examples

The following examples show how to use sun.jvmstat.monitor.Monitor. 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: JvmstatModelImpl.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public String findByName(String name) {
    String value = valueCache.get(name);
    if (value != null) return value;
    
    try {
        Monitor mon = monitoredVm.findByName(name);
        if (mon != null) {
            value = mon.getValue().toString();
            if (Utils.getVariability(mon).toString().equals(Variability_CONSTANT)) {
                valueCache.put(name,value);
            }
        }
        return value;
    } catch (MonitorException ex) {
        ErrorManager.getDefault().notify(ErrorManager.WARNING,ex);
    }
    return null;
}
 
Example #2
Source File: PerfCounters.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #3
Source File: PerfCounters.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #4
Source File: PerfCounters.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #5
Source File: PerfCounters.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #6
Source File: PerfCounters.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #7
Source File: PerfCounters.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #8
Source File: JvmstatCountersPackages.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void getPackage(Map<String,JvmstatCountersPackage> packages, Monitor monitor, int pos, String name) {
    String pckName;
    String probeName;
    JvmstatCountersPackage pck;
    int dots = 0;
    int i;
    
    for (i = 0; i< name.length(); i++) {
        char ch = name.charAt(i);
        if (ch == '.') {
            dots++;
            if (dots == 2) {
                break;
            }
        }    
    }
    if (dots == 2) {
        pckName = name.substring(0,i);
        probeName = name.substring(i+1);
        pck = packages.get(pckName);
        if (pck == null) {
            pck = new JvmstatCountersPackage(this,pckName,packages.size());
            packages.put(pckName,pck);
        }
        pck.addProbe(monitor,pos,probeName);
    }
}
 
Example #9
Source File: PerfCounters.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #10
Source File: JvmstatCounterProbe.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
JvmstatCounterProbe(String name, String desc, Monitor c) {
    super(createItemDescriptors(name, desc, c));
    counter = c;
    String u = Utils.getUnits(c).toString();
  
    ticks = u.equals(Units_TICKS) || (u.equals(Units_EVENTS) && Utils.getVariability(c).toString().equals(Variability_MONOTONIC));
}
 
Example #11
Source File: JvmstatCounterFormatter.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
JvmstatCounterFormatter(Monitor c) {
    counter = c;
    unitsName = Utils.getUnits(counter).toString();
    if (unitsName.equals(Units_BYTES)) {
        del = ItemValueFormatter.DEFAULT_BYTES;
    } else if (unitsName.equals(Units_EVENTS)) {
        del = ItemValueFormatter.DEFAULT_DECIMAL;
    } else if (unitsName.equals(Units_TICKS)) {
        
    }
}
 
Example #12
Source File: PerfCounters.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the performance counter with the given name.
 *
 * @param name The name of the performance counter.
 * @throws IllegalArgumentException If no counter with the given name exists.
 * @throws MonitorException If an error occurs while communicating with the VM.
 * @return The performance counter with the given name.
 */
public static PerfCounter findByName(String name)
    throws MonitorException, IllegalArgumentException {
    Monitor m = vm.findByName(name);
    if (m == null) {
        throw new IllegalArgumentException("Did not find a performance counter with name " + name);
    }
    return new PerfCounter(m, name);
}
 
Example #13
Source File: JvmstatModelImpl.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public MonitoredValue findMonitoredValueByName(String name) {
    try {
        Monitor mon = monitoredVm.findByName(name);
        if (mon != null) {
            return new MonitoredValueImpl(mon);
        }
    } catch (MonitorException ex) {
        ErrorManager.getDefault().notify(ErrorManager.WARNING,ex);
    }
    return null;
}
 
Example #14
Source File: JvmstatModelImpl.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public List<MonitoredValue> findMonitoredValueByPattern(String pattern) {
    try {
        List<Monitor> monitorList = monitoredVm.findByPattern(pattern);
        List<MonitoredValue> monitoredValueList = new ArrayList(monitorList.size());
        for (Monitor monitor : monitorList) {
            monitoredValueList.add(new MonitoredValueImpl(monitor));
        }
        return monitoredValueList;
    } catch (MonitorException ex) {
        ErrorManager.getDefault().notify(ErrorManager.WARNING,ex);
    }
    return null;  
}
 
Example #15
Source File: JvmstatModelImpl.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public List<String> findByPattern(String pattern) {
    try {
        List<Monitor> monitorList = monitoredVm.findByPattern(pattern);
        List<String> monitorStrList = new ArrayList<String>(monitorList.size());
        for (Monitor monitor : monitorList) {
            monitorStrList.add(monitor.getValue().toString());
        }
        return monitorStrList;
    } catch (MonitorException ex) {
        ErrorManager.getDefault().notify(ErrorManager.WARNING,ex);
    }
    return null;
}
 
Example #16
Source File: JvmstatCountersPackages.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private TracerPackage<Application>[] computePackages() {
    List counters;
    Iterator it;
    Map<String,JvmstatCountersPackage> packages = new HashMap();
    
    try {
        counters = monitoredVm.findByPattern(".*");
        Collections.sort(counters,new Comparator<Monitor>() {
            public int compare(Monitor o1, Monitor o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });
        it = counters.iterator();
        for (int i=0;it.hasNext();i++) {
            Monitor monitor = (Monitor) it.next();
            String unitsName = Utils.getUnits(monitor).toString();
            String var = Utils.getVariability(monitor).toString();
            String name = monitor.getName();
            String baseName = monitor.getBaseName();
            
            if (unitsName.equals(Units_STRING) || unitsName.equals(Units_INVALID) || unitsName.equals(Units_NONE)) {
                continue;
            }
            if (var.equals(Variability_INVALID) || var.equals(Variability_CONSTANT)) {
                continue;
            }
            if (monitor.isVector()) {
                continue;
            }
            getPackage(packages,monitor,i,name);
         }
    } catch (MonitorException ex) {
        LOGGER.log(Level.INFO,"findByPattern failed",ex);  // NOI18N
    }
    return packages.values().toArray(new TracerPackage[0]);
}
 
Example #17
Source File: Arguments.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Comparator<Monitor> comparator() {
    return comparator;
}
 
Example #18
Source File: PerfCounter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
PerfCounter(Monitor monitor, String name) {
    this.monitor = monitor;
    this.name = name;
}
 
Example #19
Source File: Arguments.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Comparator<Monitor> comparator() {
    return comparator;
}
 
Example #20
Source File: Utils.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
static Object getVariability(Monitor monitor) {
    return invokeGetter(monitor, getVariabilityMethod);
}
 
Example #21
Source File: JCmd.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int compare(Monitor m1, Monitor m2) {
    String name1 = m1.getName();
    String name2 = m2.getName();
    return name1.compareTo(name2);
}
 
Example #22
Source File: Utils.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
static Object getUnits(Monitor monitor) {
    return invokeGetter(monitor, getUnitsMethod);
}
 
Example #23
Source File: Utils.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
static Object getVariability(Monitor monitor) {
    return invokeGetter(monitor, getVariabilityMethod);
}
 
Example #24
Source File: JCmd.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int compare(Monitor m1, Monitor m2) {
    String name1 = m1.getName();
    String name2 = m2.getName();
    return name1.compareTo(name2);
}
 
Example #25
Source File: JCmd.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int compare(Monitor m1, Monitor m2) {
    String name1 = m1.getName();
    String name2 = m2.getName();
    return name1.compareTo(name2);
}
 
Example #26
Source File: MonitoredValueImpl.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
MonitoredValueImpl(Monitor mon) {
    monitor = mon;
}
 
Example #27
Source File: Arguments.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Comparator<Monitor> comparator() {
    return comparator;
}
 
Example #28
Source File: JCmd.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public int compare(Monitor m1, Monitor m2) {
    String name1 = m1.getName();
    String name2 = m2.getName();
    return name1.compareTo(name2);
}
 
Example #29
Source File: Arguments.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public Comparator<Monitor> comparator() {
    return comparator;
}
 
Example #30
Source File: Arguments.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public Comparator<Monitor> comparator() {
    return comparator;
}