Search in sources :

Example 31 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project gocd by gocd.

the class GCInformationProvider method asJson.

@Override
public Map<String, Object> asJson() {
    List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
    LinkedHashMap<String, Object> json = new LinkedHashMap<>();
    for (GarbageCollectorMXBean gcBean : garbageCollectorMXBeans) {
        LinkedHashMap<String, Object> gcBeanParms = new LinkedHashMap<>();
        gcBeanParms.put("Memory Pool Names", Arrays.toString(gcBean.getMemoryPoolNames()));
        gcBeanParms.put("Collection Count", gcBean.getCollectionCount());
        gcBeanParms.put("Collection Time", gcBean.getCollectionTime());
        json.put(gcBean.getName(), gcBeanParms);
    }
    return json;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) LinkedHashMap(java.util.LinkedHashMap)

Example 32 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project Payara by payara.

the class JVMGCStatsProvider method getCollectionTime.

@ManagedAttribute(id = "collectiontime-count")
@Description("approximate accumulated collection elapsed time in milliseconds")
public CountStatistic getCollectionTime() {
    long times = -1;
    int i = 0;
    for (GarbageCollectorMXBean gcBean : gcBeanList) {
        if (gcBean.getName().equals(gcName)) {
            times = gcBean.getCollectionTime();
        }
    }
    collectionTimeCount.setCount(times);
    return collectionTimeCount;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) Description(org.glassfish.gmbal.Description) ManagedAttribute(org.glassfish.gmbal.ManagedAttribute)

Example 33 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project Payara by payara.

the class JVMStatsProviderBootstrap method postConstruct.

public void postConstruct() {
    /* register with monitoring */
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "", sRuntimeStatsProvider, ContainerMonitoring.LEVEL_LOW);
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/class-loading-system", clStatsProvider, ContainerMonitoring.LEVEL_LOW);
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/compilation-system", compileStatsProvider, ContainerMonitoring.LEVEL_LOW);
    for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
        JVMGCStatsProvider jvmStatsProvider = new JVMGCStatsProvider(gc.getName());
        jvmStatsProviderList.add(jvmStatsProvider);
        StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/garbage-collectors/" + gc.getName(), jvmStatsProvider, ContainerMonitoring.LEVEL_LOW);
    }
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/memory", memoryStatsProvider, ContainerMonitoring.LEVEL_LOW);
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/operating-system", osStatsProvider, ContainerMonitoring.LEVEL_LOW);
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/runtime", runtimeStatsProvider, ContainerMonitoring.LEVEL_LOW);
    StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/thread-system", threadSysStatsProvider, ContainerMonitoring.LEVEL_LOW);
    for (ThreadInfo t : threadBean.getThreadInfo(threadBean.getAllThreadIds(), 5)) {
        // See issue #12636
        if (t == null)
            continue;
        JVMThreadInfoStatsProvider threadInfoStatsProvider = new JVMThreadInfoStatsProvider(t);
        StatsProviderManager.register("jvm", PluginPoint.SERVER, "jvm/thread-system/thread-" + t.getThreadId(), threadInfoStatsProvider, ContainerMonitoring.LEVEL_HIGH);
    }
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Example 34 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project incubator-systemml by apache.

the class Statistics method getJVMgcTime.

public static long getJVMgcTime() {
    long ret = 0;
    List<GarbageCollectorMXBean> gcxs = ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean gcx : gcxs) ret += gcx.getCollectionTime();
    if (ret > 0)
        ret += jvmGCTime;
    return ret;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Example 35 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project incubator-systemml by apache.

the class Statistics method getJVMgcCount.

public static long getJVMgcCount() {
    long ret = 0;
    List<GarbageCollectorMXBean> gcxs = ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean gcx : gcxs) ret += gcx.getCollectionCount();
    if (ret > 0)
        ret += jvmGCCount;
    return ret;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Aggregations

GarbageCollectorMXBean (java.lang.management.GarbageCollectorMXBean)62 MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)10 RuntimeMXBean (java.lang.management.RuntimeMXBean)10 MemoryMXBean (java.lang.management.MemoryMXBean)8 HashMap (java.util.HashMap)8 MemoryUsage (java.lang.management.MemoryUsage)6 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)6 ArrayList (java.util.ArrayList)6 Map (java.util.Map)5 ThreadMXBean (java.lang.management.ThreadMXBean)4 ClassLoadingMXBean (java.lang.management.ClassLoadingMXBean)3 ObjectName (javax.management.ObjectName)3 Date (java.util.Date)2 LinkedHashMap (java.util.LinkedHashMap)2 NotificationEmitter (javax.management.NotificationEmitter)2 MetricGroup (org.apache.flink.metrics.MetricGroup)2 MetricsInfo (org.apache.hadoop.metrics2.MetricsInfo)2 Metric (com.codahale.metrics.Metric)1 Checkpoint (com.datatorrent.stram.api.Checkpoint)1 ContainerStatsEvent (com.datatorrent.stram.api.ContainerEvent.ContainerStatsEvent)1