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;
}
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();
}
});
}
}
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();
}
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();
}
});
}
}
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;
}
Aggregations