本文整理匯總了Java中java.lang.management.CompilationMXBean.getTotalCompilationTime方法的典型用法代碼示例。如果您正苦於以下問題:Java CompilationMXBean.getTotalCompilationTime方法的具體用法?Java CompilationMXBean.getTotalCompilationTime怎麽用?Java CompilationMXBean.getTotalCompilationTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.management.CompilationMXBean
的用法示例。
在下文中一共展示了CompilationMXBean.getTotalCompilationTime方法的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: 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;
}
示例3: 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;
}
}
示例4: 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)
);
}
示例5: getCompilationTime
import java.lang.management.CompilationMXBean; //導入方法依賴的package包/類
long getCompilationTime() {
CompilationMXBean bean = ManagementFactory.getCompilationMXBean();
return bean.getTotalCompilationTime();
}
示例6: run
import java.lang.management.CompilationMXBean; //導入方法依賴的package包/類
public void run() {
TelemetryDataDto telemetryDataDto = new TelemetryDataDto();
telemetryDataDto.time = System.currentTimeMillis();
Runtime runtime = Runtime.getRuntime();
telemetryDataDto.freeMemory = runtime.freeMemory();
telemetryDataDto.maxMemory = runtime.maxMemory();
telemetryDataDto.totalMemory = runtime.totalMemory();
ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
telemetryDataDto.loadedClassCount = classLoadingMXBean.getLoadedClassCount();
telemetryDataDto.classCount = classLoadingMXBean.getTotalLoadedClassCount();
telemetryDataDto.unloadedClassCount = classLoadingMXBean.getUnloadedClassCount();
CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean();
telemetryDataDto.totalCompilationTime = compilationMXBean.getTotalCompilationTime();
if (null != profiler)
profiler.sendMessage(new TelemetryDataMessage(telemetryDataDto));
}