本文整理汇总了Java中sun.jvmstat.monitor.Monitor类的典型用法代码示例。如果您正苦于以下问题:Java Monitor类的具体用法?Java Monitor怎么用?Java Monitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Monitor类属于sun.jvmstat.monitor包,在下文中一共展示了Monitor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printMonitor
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
private static void printMonitor(Monitor monitor){
System.out.print(monitor.getName());
System.out.print(" = ");
System.out.print(monitor.getValue());
Units unit = monitor.getUnits();
if((unit.intValue() != Units.NONE.intValue()) &&
(unit.intValue() != Units.STRING.intValue())){
System.out.print(" (");
System.out.print(monitor.getUnits());
System.out.print(")");
}
System.out.println();
}
示例2: findByName
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
/**
* 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);
}
示例3: printPerfData
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public void printPerfData() {
try {
List<Monitor> r = monitoredVm.findByPattern("");
for (Monitor m : r) {
System.out.println(m.getName() + "\t" + m.getValue().toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: findByName
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
private Monitor findByName(String name) {
try {
return getThisVm().findByName(name);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: perfInt
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public int perfInt(String name) {
Monitor mon = findByName(name);
if (mon == null) {
throw new IllegalArgumentException("no such counter: " + name);
}
if (mon instanceof IntegerMonitor) {
return ((IntegerMonitor)mon).intValue();
} else if (mon instanceof LongMonitor) {
return (int) ((LongMonitor)mon).longValue();
} else {
throw new IllegalArgumentException(name + " is not an int");
}
}
示例6: perfLong
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public long perfLong(String name) {
Monitor mon = findByName(name);
if (mon == null) {
throw new IllegalArgumentException("no such counter: " + name);
}
if (mon instanceof LongMonitor) {
return ((LongMonitor)mon).longValue();
} else {
throw new IllegalArgumentException(name + " is not a long");
}
}
示例7: perfString
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public String perfString(String name) {
Monitor mon = findByName(name);
if (mon == null) {
throw new IllegalArgumentException("no such counter: " + name);
}
if (mon instanceof StringMonitor) {
return ((StringMonitor)mon).stringValue();
} else {
throw new IllegalArgumentException(name + " is not a string");
}
}
示例8: comparator
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public Comparator<Monitor> comparator() {
return comparator;
}
示例9: compare
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public int compare(Monitor m1, Monitor m2) {
String name1 = m1.getName();
String name2 = m2.getName();
return name1.compareTo(name2);
}
示例10: PerfCounter
import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
PerfCounter(Monitor monitor, String name) {
this.monitor = monitor;
this.name = name;
}