use of java.lang.management.CompilationMXBean in project MyPerf4J by ThinkpadNC5.
the class CompilationTest method test.
@Test
public void test() {
CompilationMXBean mxBean = ManagementFactory.getCompilationMXBean();
System.out.println(mxBean.getName());
System.out.println(mxBean.getObjectName());
System.out.println(mxBean.getTotalCompilationTime() + "ms");
}
use of java.lang.management.CompilationMXBean in project jdk8u_jdk by JetBrains.
the class MXBeanInteropTest1 method doCompilationMXBeanTest.
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;
}
use of java.lang.management.CompilationMXBean in project openj9 by eclipse.
the class TestManagementFactory method testCompilationMXBeanProxy.
@Test
public void testCompilationMXBeanProxy() {
try {
CompilationMXBean proxy = ManagementFactory.newPlatformMXBeanProxy(ManagementFactory.getPlatformMBeanServer(), "java.lang:type=Compilation", CompilationMXBean.class);
AssertJUnit.assertNotNull(proxy);
AssertJUnit.assertNotNull(proxy.toString());
AssertJUnit.assertEquals("java.lang:type=Compilation", proxy.getObjectName().toString());
AssertJUnit.assertEquals(proxy.getName(), ManagementFactory.getCompilationMXBean().getName());
AssertJUnit.assertEquals(proxy.isCompilationTimeMonitoringSupported(), ManagementFactory.getCompilationMXBean().isCompilationTimeMonitoringSupported());
if (!proxy.isCompilationTimeMonitoringSupported()) {
try {
long tct = proxy.getTotalCompilationTime();
Assert.fail("Should have thrown unsupported operation exception!");
} catch (UnsupportedOperationException t) {
logger.debug("UnsupportedOperationException occurred, as expected: " + t.getMessage());
}
}
} catch (IOException e) {
Assert.fail("Unexpected IOException : " + e.getMessage());
e.printStackTrace();
}
}
Aggregations