本文整理匯總了Java中java.lang.management.CompilationMXBean.isCompilationTimeMonitoringSupported方法的典型用法代碼示例。如果您正苦於以下問題:Java CompilationMXBean.isCompilationTimeMonitoringSupported方法的具體用法?Java CompilationMXBean.isCompilationTimeMonitoringSupported怎麽用?Java CompilationMXBean.isCompilationTimeMonitoringSupported使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.management.CompilationMXBean
的用法示例。
在下文中一共展示了CompilationMXBean.isCompilationTimeMonitoringSupported方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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");
}
}
示例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");
}
}
示例4: 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 ;
}
示例5: 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;
}
示例6: 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;
}
}