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


Java ManagementFactoryHelper.getDiagnosticMXBean方法代码示例

本文整理汇总了Java中sun.management.ManagementFactoryHelper.getDiagnosticMXBean方法的典型用法代码示例。如果您正苦于以下问题:Java ManagementFactoryHelper.getDiagnosticMXBean方法的具体用法?Java ManagementFactoryHelper.getDiagnosticMXBean怎么用?Java ManagementFactoryHelper.getDiagnosticMXBean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.management.ManagementFactoryHelper的用法示例。


在下文中一共展示了ManagementFactoryHelper.getDiagnosticMXBean方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVMOption

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:20,代码来源:CompilerWhiteBoxTest.java

示例2: main

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
public static void main(String[] args) {
    HotSpotDiagnosticMXBean hsd = ManagementFactoryHelper.getDiagnosticMXBean();

    // 打印虚拟机的某个配置参数的值
    VMOption vmo = hsd.getVMOption("UseCompressedOops");
    System.out.println(vmo.getName() + " | " + vmo.getValue());

    hsd.getDiagnosticOptions().stream().forEach(System.out::println);
}
 
开发者ID:walle-liao,项目名称:jaf-examples,代码行数:10,代码来源:PrintVmOptions.java

示例3: main

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    System.out.println("Max memory= " + MAX_MEMORY + " bytes");

    int obj_size = 0;
    long seconds_to_run = 0;
    if (args.length != 2) {
        throw new RuntimeException("Object size argument must be supplied");
    } else {
        obj_size = Integer.parseInt(args[0]);
        seconds_to_run = Integer.parseInt(args[1]);
    }
    System.out.println("Objects size= " + obj_size + " bytes");
    System.out.println("Seconds to run=" + seconds_to_run);

    int region_size =
        Integer.parseInt(diagnostic.getVMOption("G1HeapRegionSize").getValue());
    if (obj_size < (region_size / 2)) {
        throw new RuntimeException("Object size " + obj_size +
                                   " is not humongous with region size " + region_size);
    }

    ExecutorService executor =
        Executors.newFixedThreadPool(THREAD_COUNT, new NamedThreadFactory());
    System.out.println("Starting " + THREAD_COUNT + " threads");

    for (int i = 0; i < THREAD_COUNT; i++) {
        executor.execute(new Runner(obj_size));
    }

    Thread.sleep(seconds_to_run * 1000);
    executor.shutdownNow();

    if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
        System.err.println("Thread pool did not terminate after 10 seconds after shutdown");
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:39,代码来源:TestGreyReclaimedHumongousObjects.java

示例4: testingG1GC

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
public static boolean testingG1GC() {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    VMOption option = diagnostic.getVMOption("UseG1GC");
    if (option.getValue().equals("false")) {
      System.out.println("Skipping this test. It is only a G1 test.");
      return false;
    }
    return true;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:11,代码来源:TestSummarizeRSetStatsTools.java

示例5: main

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  String expectedValue = getExpectedValue(args);
  VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:10,代码来源:TestG1HeapRegionSize.java

示例6: getVMOption

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
public static String getVMOption(String name) {
    String result;
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    result = diagnostic.getVMOption(name).getValue();
    return result;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:15,代码来源:Utils.java

示例7: main

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("UseG1GC");
  if (option.getValue().equals("false")) {
    System.out.println("Skipping this test. It is only a G1 test.");
    return;
  }

  String expectedValue = getExpectedValue(args);
  option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:16,代码来源:TestG1HeapRegionSize.java

示例8: getCompressedClassSpaceSize

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:7,代码来源:TestUseCompressedOopsErgoTools.java


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