当前位置: 首页>>代码示例>>Java>>正文


Java Monitor类代码示例

本文整理汇总了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();
}
 
开发者ID:YaSuenag,项目名称:perfreader,代码行数:17,代码来源:PerfReader.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:PerfCounters.java

示例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();
    }
}
 
开发者ID:peiliping,项目名称:excalibur,代码行数:11,代码来源:MonitorItem.java

示例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);
    }
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:8,代码来源:PerfReaderImpl.java

示例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");
    }
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:14,代码来源:PerfReaderImpl.java

示例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");
    }
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:12,代码来源:PerfReaderImpl.java

示例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");
    }
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:12,代码来源:PerfReaderImpl.java

示例8: comparator

import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
public Comparator<Monitor> comparator() {
    return comparator;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:Arguments.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:JCmd.java

示例10: PerfCounter

import sun.jvmstat.monitor.Monitor; //导入依赖的package包/类
PerfCounter(Monitor monitor, String name) {
    this.monitor = monitor;
    this.name = name;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:PerfCounter.java


注:本文中的sun.jvmstat.monitor.Monitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。