Java Code Examples for java.lang.management.ManagementFactory#getCompilationMXBean()

The following examples show how to use java.lang.management.ManagementFactory#getCompilationMXBean() . 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 vote down vote up
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: Test.java    From ClusterDeviceControlPlatform with MIT License 5 votes vote down vote up
private static void printCompilationInfo() {
    CompilationMXBean compilation = ManagementFactory.getCompilationMXBean();
    System.out.println("JIT编译器名称:" + compilation.getName());
    //判断jvm是否支持编译时间的监控
    if (compilation.isCompilationTimeMonitoringSupported()) {
        System.out.println("总编译时间:" + compilation.getTotalCompilationTime() + "秒");
    }
}
 
Example 3
Source File: RootPlatformMBeanResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
ResourceEntry getChildEntry(String name) {

        if (PlatformMBeanConstants.CLASS_LOADING.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.CLASS_LOADING_PATH);
        } else if (PlatformMBeanConstants.COMPILATION.equals(name) && ManagementFactory.getCompilationMXBean() != null) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.COMPILATION_PATH);
        } else if (PlatformMBeanConstants.GARBAGE_COLLECTOR.equals(name)) {
            return new GarbageCollectorMXBeanResource();
        } else if (PlatformMBeanConstants.MEMORY.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.MEMORY_PATH);
        } else if (PlatformMBeanConstants.MEMORY_MANAGER.equals(name)) {
            return new MemoryManagerMXBeanResource();
        } else if (PlatformMBeanConstants.MEMORY_POOL.equals(name)) {
            return new MemoryPoolMXBeanResource();
        } else if (PlatformMBeanConstants.OPERATING_SYSTEM.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.OPERATING_SYSTEM_PATH);
        } else if (PlatformMBeanConstants.RUNTIME.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.RUNTIME_PATH);
        } else if (PlatformMBeanConstants.THREADING.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.THREADING_PATH);
        } else if (PlatformMBeanConstants.BUFFER_POOL.equals(name)) {
            return new BufferPoolMXBeanResource();
        } else if (PlatformMBeanConstants.LOGGING.equals(name)) {
            return new LeafPlatformMBeanResource(PlatformMBeanConstants.LOGGING_PATH);
        } else {
            return null;
        }
    }
 
Example 4
Source File: JvmCompilationMetrics.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@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 5
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 6
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 7
Source File: OperatingSystemInfoUtil.java    From Deta_Cache with Apache License 2.0 5 votes vote down vote up
/**
	 * 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 8
Source File: JvmCompilationImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 9
Source File: JVMInfo.java    From light-task-scheduler with Apache License 2.0 4 votes vote down vote up
private JVMInfo() {
    classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
    compilationMXBean = ManagementFactory.getCompilationMXBean();
    runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    properties = System.getProperties();
}
 
Example 10
Source File: JMXGoodies.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
public DetailsHandler compilation() {
	return new DetailsHandler("Compilation", ManagementFactory.getCompilationMXBean(), "-objectName");
}
 
Example 11
Source File: JvmCompilationImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 12
Source File: JvmCompilationImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 13
Source File: JvmCompilationImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 14
Source File: JvmCompilationImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 15
Source File: JvmCompilationImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static CompilationMXBean getCompilationMXBean() {
    return ManagementFactory.getCompilationMXBean();
}
 
Example 16
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Factory method for "JvmCompilation" group metadata class.
 *
 * You can redefine this method if you need to replace the default
 * generated metadata class with your own customized class.
 *
 * @param groupName Name of the group ("JvmCompilation")
 * @param groupOid  OID of this group
 * @param groupObjname ObjectName for this group (may be null)
 * @param server    MBeanServer for this group (may be null)
 *
 * @return An instance of the metadata class generated for the
 *         "JvmCompilation" group (JvmCompilationMeta)
 *
 **/
protected JvmCompilationMeta
    createJvmCompilationMetaNode(String groupName,
                                 String groupOid,
                                 ObjectName groupObjname,
                                 MBeanServer server)  {
    // If there is no compilation system, the jvmCompilation  will not
    // be instantiated.
    //
    if (ManagementFactory.getCompilationMXBean() == null) return null;
    return super.createJvmCompilationMetaNode(groupName,groupOid,
                                              groupObjname,server);
}
 
Example 17
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Factory method for "JvmCompilation" group metadata class.
 *
 * You can redefine this method if you need to replace the default
 * generated metadata class with your own customized class.
 *
 * @param groupName Name of the group ("JvmCompilation")
 * @param groupOid  OID of this group
 * @param groupObjname ObjectName for this group (may be null)
 * @param server    MBeanServer for this group (may be null)
 *
 * @return An instance of the metadata class generated for the
 *         "JvmCompilation" group (JvmCompilationMeta)
 *
 **/
protected JvmCompilationMeta
    createJvmCompilationMetaNode(String groupName,
                                 String groupOid,
                                 ObjectName groupObjname,
                                 MBeanServer server)  {
    // If there is no compilation system, the jvmCompilation  will not
    // be instantiated.
    //
    if (ManagementFactory.getCompilationMXBean() == null) return null;
    return super.createJvmCompilationMetaNode(groupName,groupOid,
                                              groupObjname,server);
}
 
Example 18
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Factory method for "JvmCompilation" group metadata class.
 *
 * You can redefine this method if you need to replace the default
 * generated metadata class with your own customized class.
 *
 * @param groupName Name of the group ("JvmCompilation")
 * @param groupOid  OID of this group
 * @param groupObjname ObjectName for this group (may be null)
 * @param server    MBeanServer for this group (may be null)
 *
 * @return An instance of the metadata class generated for the
 *         "JvmCompilation" group (JvmCompilationMeta)
 *
 **/
protected JvmCompilationMeta
    createJvmCompilationMetaNode(String groupName,
                                 String groupOid,
                                 ObjectName groupObjname,
                                 MBeanServer server)  {
    // If there is no compilation system, the jvmCompilation  will not
    // be instantiated.
    //
    if (ManagementFactory.getCompilationMXBean() == null) return null;
    return super.createJvmCompilationMetaNode(groupName,groupOid,
                                              groupObjname,server);
}
 
Example 19
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Factory method for "JvmCompilation" group metadata class.
 *
 * You can redefine this method if you need to replace the default
 * generated metadata class with your own customized class.
 *
 * @param groupName Name of the group ("JvmCompilation")
 * @param groupOid  OID of this group
 * @param groupObjname ObjectName for this group (may be null)
 * @param server    MBeanServer for this group (may be null)
 *
 * @return An instance of the metadata class generated for the
 *         "JvmCompilation" group (JvmCompilationMeta)
 *
 **/
protected JvmCompilationMeta
    createJvmCompilationMetaNode(String groupName,
                                 String groupOid,
                                 ObjectName groupObjname,
                                 MBeanServer server)  {
    // If there is no compilation system, the jvmCompilation  will not
    // be instantiated.
    //
    if (ManagementFactory.getCompilationMXBean() == null) return null;
    return super.createJvmCompilationMetaNode(groupName,groupOid,
                                              groupObjname,server);
}
 
Example 20
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Factory method for "JvmCompilation" group metadata class.
 *
 * You can redefine this method if you need to replace the default
 * generated metadata class with your own customized class.
 *
 * @param groupName Name of the group ("JvmCompilation")
 * @param groupOid  OID of this group
 * @param groupObjname ObjectName for this group (may be null)
 * @param server    MBeanServer for this group (may be null)
 *
 * @return An instance of the metadata class generated for the
 *         "JvmCompilation" group (JvmCompilationMeta)
 *
 **/
protected JvmCompilationMeta
    createJvmCompilationMetaNode(String groupName,
                                 String groupOid,
                                 ObjectName groupObjname,
                                 MBeanServer server)  {
    // If there is no compilation system, the jvmCompilation  will not
    // be instantiated.
    //
    if (ManagementFactory.getCompilationMXBean() == null) return null;
    return super.createJvmCompilationMetaNode(groupName,groupOid,
                                              groupObjname,server);
}