java.lang.management.CompilationMXBean Java Examples
The following examples show how to use
java.lang.management.CompilationMXBean.
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: JvmMetrics.java From astor with GNU General Public License v2.0 | 6 votes |
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.println(String.format( "\t%s jit time: %d ms", name, cBean.getTotalCompilationTime())); } else { out.println(normalizeTabularColonPos(String.format("%s-jit-time-ms : %d", normalizeName(name), cBean.getTotalCompilationTime()))); } }
Example #2
Source File: CompilationTimeSensor.java From swage with Apache License 2.0 | 6 votes |
@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 #3
Source File: MXBeanInteropTest1.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #4
Source File: CompilerDataProviderTest.java From perfmon-agent with Apache License 2.0 | 5 votes |
/** * Test of getMXBeanClass method, of class CompilerDataProvider. */ public void testGetMXBeanClass() throws Exception { System.out.println("getMXBeanClass"); CompilerDataProvider instance = new CompilerDataProvider(new EmulatorMBeanServerConnection(), false); Class expResult = CompilationMXBean.class; Class result = instance.getMXBeanClass(); assertEquals(expResult, result); }
Example #5
Source File: Statistics.java From systemds with Apache License 2.0 | 5 votes |
/** * 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 #6
Source File: CompilationSampler.java From kieker with Apache License 2.0 | 5 votes |
@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 #7
Source File: ProxyClient.java From jvmtop with GNU General Public License v2.0 | 5 votes |
public synchronized CompilationMXBean getCompilationMXBean() throws IOException { if (hasCompilationMXBean && compilationMBean == null) { compilationMBean = newPlatformMXBeanProxy(server, COMPILATION_MXBEAN_NAME, CompilationMXBean.class); } return compilationMBean; }
Example #8
Source File: ProxyClient.java From jmxmon with Apache License 2.0 | 5 votes |
public synchronized CompilationMXBean getCompilationMXBean() throws IOException { if (hasCompilationMXBean && compilationMBean == null) { compilationMBean = newPlatformMXBeanProxy(server, COMPILATION_MXBEAN_NAME, CompilationMXBean.class); } return compilationMBean; }
Example #9
Source File: MXBeanInteropTest1.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #10
Source File: JvmMXBeansFactory.java From visualvm with GNU General Public License v2.0 | 5 votes |
/** * Returns an MXBean proxy for the compilation system of the JVM. */ public synchronized CompilationMXBean getCompilationMXBean() { if (mbsc != null && compilationMXBean == null) { compilationMXBean = getMXBean(COMPILATION_MXBEAN_NAME, CompilationMXBean.class); } return compilationMXBean; }
Example #11
Source File: MXBeanInteropTest1.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #12
Source File: OperatingSystemInfoUtil.java From Deta_Cache with Apache License 2.0 | 5 votes |
/** * Java ������ı���ϵͳ */ public static Map<String, String> showCompilation(){ Map<String, String> map = new HashMap<>(); CompilationMXBean com = ManagementFactory.getCompilationMXBean(); map.put("TotalCompilationTime:", "" + com.getTotalCompilationTime()); map.put("name:", "" + com.getName()); return map; // System.out.println("TotalCompilationTime:" + com.getTotalCompilationTime()); // System.out.println("name:" + com.getName()); }
Example #13
Source File: MXBeanInteropTest1.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #14
Source File: Test.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
private static void printCompilationInfo() { CompilationMXBean compilation = ManagementFactory.getCompilationMXBean(); System.out.println("JIT编译器名称:" + compilation.getName()); //判断jvm是否支持编译时间的监控 if (compilation.isCompilationTimeMonitoringSupported()) { System.out.println("总编译时间:" + compilation.getTotalCompilationTime() + "秒"); } }
Example #15
Source File: Test.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
private static void printCompilationInfo() { CompilationMXBean compilation = ManagementFactory.getCompilationMXBean(); System.out.println("JIT编译器名称:" + compilation.getName()); //判断jvm是否支持编译时间的监控 if (compilation.isCompilationTimeMonitoringSupported()) { System.out.println("总编译时间:" + compilation.getTotalCompilationTime() + "秒"); } }
Example #16
Source File: JvmCompilationMetricsTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void compilationTimeMetric() { new JvmCompilationMetrics().bindTo(registry); CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean(); assumeTrue(compilationMXBean != null && compilationMXBean.isCompilationTimeMonitoringSupported()); assertThat(registry.get("jvm.compilation.time").functionCounter().count()).isGreaterThan(0); }
Example #17
Source File: MXBeanInteropTest1.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #18
Source File: JvmCompilationMetrics.java From micrometer with Apache License 2.0 | 5 votes |
@Override public void bindTo(MeterRegistry registry) { CompilationMXBean compilationBean = ManagementFactory.getCompilationMXBean(); if (compilationBean != null && compilationBean.isCompilationTimeMonitoringSupported()) { FunctionCounter.builder("jvm.compilation.time", compilationBean, CompilationMXBean::getTotalCompilationTime) .tags(Tags.concat(tags, "compiler", compilationBean.getName())) .description("The approximate accumulated elapsed time spent in compilation") .baseUnit(BaseUnits.MILLISECONDS) .register(registry); } }
Example #19
Source File: SysUtil.java From game-server with MIT License | 5 votes |
/** * 类编译信息 * * @author JiangZhiYong * @QQ 359135103 2017年10月12日 下午3:39:22 * @param spliteStr * @return */ public static String compilationInfo(String spliteStr) { CompilationMXBean bean = ManagementFactory.getCompilationMXBean(); StringBuilder sb = new StringBuilder(); sb.append("编译器名称: " + bean.getName()).append(spliteStr); sb.append("编译耗时: " + bean.getTotalCompilationTime()).append(spliteStr); sb.append("是否支持编译监视: " + bean.isCompilationTimeMonitoringSupported()).append(spliteStr); return sb.toString(); }
Example #20
Source File: MXBeanInteropTest1.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #21
Source File: MXBeanInteropTest1.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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 ; }
Example #22
Source File: Statistics.java From systemds with Apache License 2.0 | 5 votes |
/** * 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 #23
Source File: VmCommand.java From LagMonitor with MIT License | 4 votes |
private void displayCompilationInfo(CommandSender sender, CompilationMXBean compilationBean) { sendMessage(sender, "Compiler name", compilationBean.getName()); sendMessage(sender, "Compilation time (ms)", String.valueOf(compilationBean.getTotalCompilationTime())); }
Example #24
Source File: JvmCompilationImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static CompilationMXBean getCompilationMXBean() { return ManagementFactory.getCompilationMXBean(); }
Example #25
Source File: JvmCompilationImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static CompilationMXBean getCompilationMXBean() { return ManagementFactory.getCompilationMXBean(); }
Example #26
Source File: JvmCompilationImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static CompilationMXBean getCompilationMXBean() { return ManagementFactory.getCompilationMXBean(); }
Example #27
Source File: JvmCompilationImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static CompilationMXBean getCompilationMXBean() { return ManagementFactory.getCompilationMXBean(); }
Example #28
Source File: CompilationGauge.java From metrics with Apache License 2.0 | 4 votes |
public CompilationGauge(long timeout, TimeUnit timeoutUnit, CompilationMXBean mxBean) { super(timeout, timeoutUnit); this.mxBean = mxBean; }
Example #29
Source File: VmCommand.java From LagMonitor with MIT License | 4 votes |
private void displayCompilationInfo(CommandSender sender, CompilationMXBean compilationBean) { sendMessage(sender, "Compiler name", compilationBean.getName()); sendMessage(sender, "Compilation time (ms)", String.valueOf(compilationBean.getTotalCompilationTime())); }
Example #30
Source File: TelemetryDataProvider.java From jsonde with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)); }