List of usage examples for java.lang.management CompilationMXBean getTotalCompilationTime
public long getTotalCompilationTime();
From source file:org.fluentd.jvmwatcher.data.JvmStateLog.java
/** * @param clientPrixy/*from w w w . jav a2 s.com*/ * @return */ public static JvmStateLog makeJvmStateLog(JvmClientProxy clientProxy) { JvmStateLog ret = new JvmStateLog(); try { // set log time ret.logDateTime_ = System.currentTimeMillis(); // ClassLoadingMXBean ClassLoadingMXBean classLoadingBean = clientProxy.getClassLoadingMXBean(); if (null != classLoadingBean) { ret.classLoadedCount_ = classLoadingBean.getLoadedClassCount(); ret.classUnloadedCount_ = classLoadingBean.getUnloadedClassCount(); ret.classTotalLoadedCount_ = classLoadingBean.getTotalLoadedClassCount(); } // CompilationMXBean CompilationMXBean compilationBean = clientProxy.getCompilationMXBean(); if (null != compilationBean) { ret.compileTime_ = compilationBean.getTotalCompilationTime(); } // MemoryMXBean MemoryMXBean memoryBean = clientProxy.getMemoryMXBean(); if (null != memoryBean) { ret.heapSize_ = memoryBean.getHeapMemoryUsage(); ret.notheapSize_ = memoryBean.getNonHeapMemoryUsage(); ret.pendingFinalizationCount_ = memoryBean.getObjectPendingFinalizationCount(); } // ThreadMXBean ThreadMXBean threadBean = clientProxy.getThreadMXBean(); if (null != threadBean) { ret.threadCount_ = threadBean.getThreadCount(); ret.daemonThreadCount_ = threadBean.getDaemonThreadCount(); ret.peakThreadCount_ = threadBean.getPeakThreadCount(); } // OperatingSystemMXBean OperatingSystemMXBean OpeSysBean = clientProxy.getOperatingSystemMXBean(); if (null != OpeSysBean) { ret.osAvailableProcessors_ = OpeSysBean.getAvailableProcessors(); ret.osSystemLoadAverage_ = OpeSysBean.getSystemLoadAverage(); } // com.sun.management.OperatingSystemMXBean com.sun.management.OperatingSystemMXBean sunOpeSysBean = clientProxy.getSunOperatingSystemMXBean(); if (null != sunOpeSysBean) { ret.committedVirtualMemorySize_ = sunOpeSysBean.getCommittedVirtualMemorySize(); ret.freePhysicalMemorySize_ = sunOpeSysBean.getFreePhysicalMemorySize(); ret.freeSwapSpaceSize_ = sunOpeSysBean.getFreeSwapSpaceSize(); ret.processCpuTime_ = sunOpeSysBean.getProcessCpuTime(); ret.totalPhysicalMemorySize_ = sunOpeSysBean.getTotalPhysicalMemorySize(); ret.totalSwapSpaceSize_ = sunOpeSysBean.getTotalSwapSpaceSize(); } // RuntimeMXBean RuntimeMXBean runtimeBean = clientProxy.getRuntimeMXBean(); if (null != runtimeBean) { ret.jvmUpTime_ = runtimeBean.getUptime(); } // MemoryPoolMXBean Collection<MemoryPoolClientProxy> memoryPoolBeansColl = clientProxy.getMemoryPoolClientProxies(); if (null != memoryPoolBeansColl) { ret.memoryPoolStateColl_ = new ArrayList<MemoryPoolState>(); for (MemoryPoolClientProxy elem : memoryPoolBeansColl) { if (null != elem) { MemoryPoolState state = elem.getStat(); if (null != state) { // add MemoryPoolState ret.memoryPoolStateColl_.add(state); } } } } // GarbageCollectorMXBean Collection<GarbageCollectorMXBean> garbageCollBeansColl = clientProxy.getGarbageCollectorMXBeans(); if (null != garbageCollBeansColl) { ret.gcCollectorState_ = new ArrayList<GarbageCollectorState>(); for (GarbageCollectorMXBean elem : garbageCollBeansColl) { if (null != elem) { long collectionCount = elem.getCollectionCount(); long collectionTime = elem.getCollectionTime(); String memoryManagerName = elem.getName(); GarbageCollectorState state = new GarbageCollectorState(memoryManagerName, collectionCount, collectionTime); // add GarbageCollectorState ret.gcCollectorState_.add(state); } } } } catch (IOException ex) { log.error(ex); // close JvmClientProxy clientProxy.disconnect(); } catch (Exception ex) { log.error(ex); // close JvmClientProxy clientProxy.disconnect(); } return ret; }