Search in sources :

Example 1 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project hadoop by apache.

the class JvmPauseMonitor method getGcTimes.

private Map<String, GcTimes> getGcTimes() {
    Map<String, GcTimes> map = Maps.newHashMap();
    List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean gcBean : gcBeans) {
        map.put(gcBean.getName(), new GcTimes(gcBean));
    }
    return map;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Example 2 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project flink by apache.

the class TaskExecutorMetricsInitializer method instantiateGarbageCollectorMetrics.

private static void instantiateGarbageCollectorMetrics(MetricGroup metrics) {
    List<GarbageCollectorMXBean> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans();
    for (final GarbageCollectorMXBean garbageCollector : garbageCollectors) {
        MetricGroup gcGroup = metrics.addGroup(garbageCollector.getName());
        gcGroup.<Long, Gauge<Long>>gauge("Count", new Gauge<Long>() {

            @Override
            public Long getValue() {
                return garbageCollector.getCollectionCount();
            }
        });
        gcGroup.<Long, Gauge<Long>>gauge("Time", new Gauge<Long>() {

            @Override
            public Long getValue() {
                return garbageCollector.getCollectionTime();
            }
        });
    }
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) MetricGroup(org.apache.flink.metrics.MetricGroup) Gauge(org.apache.flink.metrics.Gauge)

Example 3 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project flink by apache.

the class MemoryLogger method getGarbageCollectorStatsAsString.

/**
	 * Gets the garbage collection statistics from the JVM.
	 *
	 * @param gcMXBeans The collection of garbage collector beans.
	 * @return A string denoting the number of times and total elapsed time in garbage collection.
	 */
public static String getGarbageCollectorStatsAsString(List<GarbageCollectorMXBean> gcMXBeans) {
    StringBuilder bld = new StringBuilder("Garbage collector stats: ");
    for (GarbageCollectorMXBean bean : gcMXBeans) {
        bld.append('[').append(bean.getName()).append(", GC TIME (ms): ").append(bean.getCollectionTime());
        bld.append(", GC COUNT: ").append(bean.getCollectionCount()).append(']');
        bld.append(", ");
    }
    if (!gcMXBeans.isEmpty()) {
        bld.setLength(bld.length() - 2);
    }
    return bld.toString();
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Example 4 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project flink by apache.

the class MetricUtils method instantiateGarbageCollectorMetrics.

private static void instantiateGarbageCollectorMetrics(MetricGroup metrics) {
    List<GarbageCollectorMXBean> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans();
    for (final GarbageCollectorMXBean garbageCollector : garbageCollectors) {
        MetricGroup gcGroup = metrics.addGroup(garbageCollector.getName());
        gcGroup.gauge("Count", new Gauge<Long>() {

            @Override
            public Long getValue() {
                return garbageCollector.getCollectionCount();
            }
        });
        gcGroup.gauge("Time", new Gauge<Long>() {

            @Override
            public Long getValue() {
                return garbageCollector.getCollectionTime();
            }
        });
    }
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) MetricGroup(org.apache.flink.metrics.MetricGroup)

Example 5 with GarbageCollectorMXBean

use of java.lang.management.GarbageCollectorMXBean in project hbase by apache.

the class JvmPauseMonitor method getGcTimes.

private Map<String, GcTimes> getGcTimes() {
    Map<String, GcTimes> map = Maps.newHashMap();
    List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean gcBean : gcBeans) {
        map.put(gcBean.getName(), new GcTimes(gcBean));
    }
    return map;
}
Also used : GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean)

Aggregations

GarbageCollectorMXBean (java.lang.management.GarbageCollectorMXBean)53 MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)9 RuntimeMXBean (java.lang.management.RuntimeMXBean)9 MemoryMXBean (java.lang.management.MemoryMXBean)7 HashMap (java.util.HashMap)7 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 Date (java.util.Date)2 LinkedHashMap (java.util.LinkedHashMap)2 NotificationEmitter (javax.management.NotificationEmitter)2 ObjectName (javax.management.ObjectName)2 MetricGroup (org.apache.flink.metrics.MetricGroup)2 Metric (com.codahale.metrics.Metric)1 Checkpoint (com.datatorrent.stram.api.Checkpoint)1 ContainerStatsEvent (com.datatorrent.stram.api.ContainerEvent.ContainerStatsEvent)1 ContainerHeartbeat (com.datatorrent.stram.api.StreamingContainerUmbilicalProtocol.ContainerHeartbeat)1