use of java.lang.management.CompilationMXBean in project karaf by apache.
the class EnvironmentDumpProvider method dumpVMInformation.
private void dumpVMInformation(final PrintWriter outPW, final DateFormat dateTimeFormatInstance) {
final RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
if (mxBean == null) {
return;
}
outPW.printf(KEY_VALUE_FORMAT, "Instance name", mxBean.getName()).println();
outPW.printf(KEY_VALUE_FORMAT, "Start time", dateTimeFormatInstance.format(new Date(mxBean.getStartTime()))).println();
outPW.printf(KEY_VALUE_FORMAT, "Uptime", printDuration(mxBean.getUptime())).println();
outPW.println();
outPW.printf(KEY_VALUE_FORMAT, "Java VM", mxBean.getVmName() + " " + mxBean.getVmVersion()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "vendor", mxBean.getVmVendor()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "version", System.getProperty("java.version")).println();
outPW.println();
outPW.println("Input arguments:");
final List<String> inputArguments = mxBean.getInputArguments();
for (final String argument : inputArguments) {
if (argument != null && argument.contains("=")) {
final String[] split = argument.split("=");
outPW.printf(INDENT_KEY_VALUE_FORMAT, split[0], split[1]).println();
} else {
outPW.printf(INDENT_KEY_VALUE_FORMAT, argument, "").println();
}
}
outPW.println("Classpath:");
outPW.printf(INDENT_KEY_VALUE_FORMAT, "boot classpath", mxBean.getBootClassPath()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "library path", mxBean.getLibraryPath()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "classpath", mxBean.getClassPath()).println();
outPW.println("System properties:");
final Map<String, String> systemProperties = mxBean.getSystemProperties();
for (final Entry<String, String> property : systemProperties.entrySet()) {
outPW.printf(INDENT_KEY_VALUE_FORMAT, property.getKey(), property.getValue()).println();
}
outPW.println();
// JIT information
final CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean();
if (compilationMXBean != null) {
outPW.printf(KEY_VALUE_FORMAT, "JIT compiler", compilationMXBean.getName()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "total compile time", printDuration(compilationMXBean.getTotalCompilationTime())).println();
}
}
use of java.lang.management.CompilationMXBean in project incubator-systemml by apache.
the class Statistics method getJITCompileTime.
/**
* Returns the total time of asynchronous JIT compilation in milliseconds.
*
* @return JIT compile time
*/
public static long getJITCompileTime() {
// unsupported
long ret = -1;
CompilationMXBean cmx = ManagementFactory.getCompilationMXBean();
if (cmx.isCompilationTimeMonitoringSupported()) {
ret = cmx.getTotalCompilationTime();
// add from remote processes
ret += jitCompileTime;
}
return ret;
}
use of java.lang.management.CompilationMXBean in project systemml by apache.
the class Statistics method getJITCompileTime.
/**
* Returns the total time of asynchronous JIT compilation in milliseconds.
*
* @return JIT compile time
*/
public static long getJITCompileTime() {
// unsupported
long ret = -1;
CompilationMXBean cmx = ManagementFactory.getCompilationMXBean();
if (cmx.isCompilationTimeMonitoringSupported()) {
ret = cmx.getTotalCompilationTime();
// add from remote processes
ret += jitCompileTime;
}
return ret;
}
use of java.lang.management.CompilationMXBean in project closure-compiler by google.
the class JvmMetrics method writeJitMetrics.
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())));
}
}
use of java.lang.management.CompilationMXBean in project openj9 by eclipse.
the class TestManagementFactory method testGetCompilationMXBean.
// Need to be able to determine if there is a JIT compiler running in
// this VM. That way I can write a sensible test case for this kind
// of bean that may or may not exist at runtime.
@Test
public final void testGetCompilationMXBean() {
CompilationMXBean cb = ManagementFactory.getCompilationMXBean();
if (cb != null) {
String name = cb.getName();
AssertJUnit.assertNotNull(name);
AssertJUnit.assertTrue(name.length() > 0);
if (cb.isCompilationTimeMonitoringSupported()) {
AssertJUnit.assertTrue(cb.getTotalCompilationTime() > -1);
} else {
try {
cb.getTotalCompilationTime();
Assert.fail("Should have thrown exception.");
} catch (UnsupportedOperationException e) {
logger.debug("UnsupportedOperationException occurred, as expected: " + e.getMessage());
}
}
// end else
}
// end if
}
Aggregations