當前位置: 首頁>>代碼示例>>Java>>正文


Java CompilationMXBean類代碼示例

本文整理匯總了Java中java.lang.management.CompilationMXBean的典型用法代碼示例。如果您正苦於以下問題:Java CompilationMXBean類的具體用法?Java CompilationMXBean怎麽用?Java CompilationMXBean使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CompilationMXBean類屬於java.lang.management包,在下文中一共展示了CompilationMXBean類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sense

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
@Override
public void sense(final MetricRecorder.Context metricContext)
{
    CompilationMXBean mxBean = ManagementFactory.getCompilationMXBean();

    // Compilation time may not be supported on some platforms, skip if so.
    if (!mxBean.isCompilationTimeMonitoringSupported()) {
        return;
    }

    long total = mxBean.getTotalCompilationTime();
    metricContext.record(TOTAL_COMPILATION_TIME, total, Unit.MILLISECOND);
    metricContext.record(COMPILATION_TIME, total - prevTotal, Unit.MILLISECOND);

    this.prevTotal = total;
}
 
開發者ID:awslabs,項目名稱:swage,代碼行數:17,代碼來源:CompilationTimeSensor.java

示例2: main

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
public static void main(String[] args)
{
  CompilationMXBean bean = ManagementFactory.getCompilationMXBean();
  if (bean == null)
    {
      System.out.println("The compilation bean is not supported by this VM.");
      System.exit(-1);
    }
  System.out.println("Bean: " + bean);
  System.out.println("JIT compiler name: " + bean.getName());
  boolean timeMonitoring = bean.isCompilationTimeMonitoringSupported();
  System.out.println("Compilation time monitoring supported: " + timeMonitoring);
  if (timeMonitoring)
    {
      System.out.println("Compilation time: "
                         + bean.getTotalCompilationTime() + "ms");
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:19,代碼來源:TestCompilation.java

示例3: main

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
public static void main(String[] args)
 {
   CompilationMXBean bean = ManagementFactory.getCompilationMXBean();
   if (bean == null)
     {
System.out.println("The compilation bean is not supported by this VM.");
System.exit(-1);
     }
   System.out.println("Bean: " + bean);
   System.out.println("JIT compiler name: " + bean.getName());
   boolean timeMonitoring = bean.isCompilationTimeMonitoringSupported();
   System.out.println("Compilation time monitoring supported: " + timeMonitoring);
   if (timeMonitoring)
     {
System.out.println("Compilation time: "
		   + bean.getTotalCompilationTime() + "ms");
     }
 }
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:19,代碼來源:TestCompilation.java

示例4: writeJitMetrics

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
private static void writeJitMetrics(
    PrintStream out, boolean verbose, boolean pretty) {

  CompilationMXBean cBean = ManagementFactory.getCompilationMXBean();

  String name;
  if (verbose) {
    name = cBean.getName();
  } else {
    name = "total";
  }

  if (pretty) {
    out.println("\nJIT Stats");
    out.println(String.format(
        "\t%s jit time: %d ms", name, cBean.getTotalCompilationTime()));
  } else {
    out.println(normalizeTabularColonPos(String.format("%s-jit-time-ms : %d",
        normalizeName(name), cBean.getTotalCompilationTime())));
  }
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:22,代碼來源:JvmMetrics.java

示例5: writeJitMetrics

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
private static void writeJitMetrics(
    PrintStream out, boolean verbose, boolean pretty) {

  CompilationMXBean cBean = ManagementFactory.getCompilationMXBean();

  String name;
  if (verbose) {
    name = cBean.getName();
  } else {
    name = "total";
  }

  if (pretty) {
    out.println("\nJIT Stats");
    out.printf("\t%s jit time: %d ms%n", name, cBean.getTotalCompilationTime());
  } else {
    out.println(normalizeTabularColonPos(String.format("%s-jit-time-ms : %d",
        normalizeName(name), cBean.getTotalCompilationTime())));
  }
}
 
開發者ID:google,項目名稱:closure-compiler,代碼行數:21,代碼來源:JvmMetrics.java

示例6: addCompilationBeanInfo

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
/**
 * Creates the metadata for the
 * {@link java.lang.management.CompilationMXBean}. For this type of
 * platform bean the metadata covers :
 * <ul>
 * <li>3 attributes
 * <li>0 constructors
 * <li>0 operations
 * <li>0 notifications
 * </ul>
 * 
 * @param result
 */
private static void addCompilationBeanInfo(HashMap<String, MBeanInfo> result) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[3];
    attributes[0] = new MBeanAttributeInfo("Name", String.class.getName(),
            "Name", true, false, false);
    attributes[1] = new MBeanAttributeInfo("TotalCompilationTime",
            Long.TYPE.getName(), "TotalCompilationTime", true, false, false);
    attributes[2] = new MBeanAttributeInfo(
            "CompilationTimeMonitoringSupported", Boolean.TYPE.getName(),
            "CompilationTimeMonitoringSupported", true, false, true);
    result.put(CompilationMXBean.class.getName(), new MBeanInfo(
            CompilationMXBeanImpl.class.getName(),
            CompilationMXBeanImpl.class.getName(), attributes, null, null,
            null));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:29,代碼來源:ManagementUtils.java

示例7: doCompilationMXBeanTest

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
private final int doCompilationMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- CompilationMXBean") ;

    try {
        ObjectName compilationName =
                new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME);

        if ( mbsc.isRegistered(compilationName) ) {
            MBeanInfo mbInfo = mbsc.getMBeanInfo(compilationName);
            errorCount += checkNonEmpty(mbInfo);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            CompilationMXBean compilation = null ;

            compilation =
                    JMX.newMXBeanProxy(mbsc,
                    compilationName,
                    CompilationMXBean.class) ;
            System.out.println("getName\t\t"
                    + compilation.getName());
            boolean supported =
                    compilation.isCompilationTimeMonitoringSupported() ;
            System.out.println("isCompilationTimeMonitoringSupported\t\t"
                    + supported);

            if ( supported ) {
                System.out.println("getTotalCompilationTime\t\t"
                        + compilation.getTotalCompilationTime());
            }
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:41,代碼來源:MXBeanInteropTest1.java

示例8: getCompilationMXBean

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
public synchronized CompilationMXBean getCompilationMXBean() throws IOException {
    if (hasCompilationMXBean && compilationMBean == null) {
        compilationMBean =
            newPlatformMXBeanProxy(server, COMPILATION_MXBEAN_NAME,
                                   CompilationMXBean.class);
    }
    return compilationMBean;
}
 
開發者ID:toomanyopenfiles,項目名稱:jmxmon,代碼行數:9,代碼來源:ProxyClient.java

示例9: getJITCompileTime

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
/**
 * Returns the total time of asynchronous JIT compilation in milliseconds.
 * 
 * @return JIT compile time
 */
public static long getJITCompileTime(){
	long ret = -1; //unsupported
	CompilationMXBean cmx = ManagementFactory.getCompilationMXBean();
	if( cmx.isCompilationTimeMonitoringSupported() )
	{
		ret = cmx.getTotalCompilationTime();
		ret += jitCompileTime; //add from remote processes
	}
	return ret;
}
 
開發者ID:apache,項目名稱:systemml,代碼行數:16,代碼來源:Statistics.java

示例10: testGetCompilationMXBean

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
public void testGetCompilationMXBean() {
    CompilationMXBean mb = ManagementFactory.getCompilationMXBean();
    assertNotNull(mb);

    // Verify that there is only instance of this bean
    CompilationMXBean mb2 = ManagementFactory.getCompilationMXBean();
    assertNotNull(mb2);
    assertSame(mb, mb2);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:10,代碼來源:ManagementFactoryTest.java

示例11: testNewPlatformMXBeanProxy_CompilationMXBean

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
public void testNewPlatformMXBeanProxy_CompilationMXBean() throws Exception {
    CompilationMXBean proxy = ManagementFactory.newPlatformMXBeanProxy(
            ManagementFactory.getPlatformMBeanServer(),
            "java.lang:type=Compilation", CompilationMXBean.class);
    assertNotNull(proxy);
    CompilationMXBean mb = ManagementFactory.getCompilationMXBean();
    assertEquals(mb.getName(), proxy.getName());
    assertEquals(mb.isCompilationTimeMonitoringSupported(), proxy
            .isCompilationTimeMonitoringSupported());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:11,代碼來源:ManagementFactoryTest.java

示例12: checkSupport

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
@Override
public boolean checkSupport(List<String> msgs) {
    CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
    if (comp.isCompilationTimeMonitoringSupported()) {
        return true;
    } else {
        msgs.add("The MXBean is available, but compilation time monitoring is disabled.");
        return false;
    }
}
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:11,代碼來源:CompilerProfiler.java

示例13: beforeIteration

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
@Override
public void beforeIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
    try {
        startCompTime = comp.getTotalCompilationTime();
    } catch (UnsupportedOperationException e) {
        startCompTime = -1;
    }
}
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:10,代碼來源:CompilerProfiler.java

示例14: afterIteration

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
    long compTime = -startCompTime;
    CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
    try {
        compTime += comp.getTotalCompilationTime();
    } catch (UnsupportedOperationException e) {
        compTime = -1;
    }

    return Arrays.asList(
            new ProfilerResult("@compiler.time.profiled", compTime, "ms", AggregationPolicy.SUM),
            new ProfilerResult("@compiler.time.total", comp.getTotalCompilationTime(), "ms", AggregationPolicy.MAX)
    );
}
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:16,代碼來源:CompilerProfiler.java

示例15: run

import java.lang.management.CompilationMXBean; //導入依賴的package包/類
@Override
public void run() {
    CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean();
    if (compilationMXBean == null) {
        output.println("Couldn't get the runtime bean!");
        return;
    }
    output.println(compilationMXBean.getTotalCompilationTime());
}
 
開發者ID:nikolavp,項目名稱:commander-shell,代碼行數:10,代碼來源:JVM.java


注:本文中的java.lang.management.CompilationMXBean類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。