Java Code Examples for java.lang.management.CompilationMXBean#getTotalCompilationTime()

The following examples show how to use java.lang.management.CompilationMXBean#getTotalCompilationTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompilationTimeSensor.java    From swage with Apache License 2.0 6 votes vote down vote up
@Override
public void sense(final MetricContext 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;
}
 
Example 2
Source File: Statistics.java    From systemds with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: CompilationSampler.java    From kieker with Apache License 2.0 5 votes vote down vote up
@Override
protected IMonitoringRecord[] createNewMonitoringRecords(final long timestamp, final String hostname, final String vmName,
		final IMonitoringController monitoringCtr) {
	if (!monitoringCtr.isProbeActivated(SignatureFactory.createJVMCompilationSignature())) {
		return new IMonitoringRecord[] {};
	}

	final CompilationMXBean compilationBean = ManagementFactory.getCompilationMXBean();

	return new IMonitoringRecord[] { new CompilationRecord(timestamp, hostname, vmName, compilationBean.getName(), compilationBean.getTotalCompilationTime()), };
}
 
Example 4
Source File: Statistics.java    From systemds with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: TelemetryDataProvider.java    From jsonde with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
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));

    }