Search in sources :

Example 1 with MemoryPool

use of org.apache.skywalking.apm.network.proto.MemoryPool in project incubator-skywalking by apache.

the class MemoryPoolModule method getMemoryPoolMetricList.

@Override
public List<MemoryPool> getMemoryPoolMetricList() {
    List<MemoryPool> poolList = new LinkedList<MemoryPool>();
    for (MemoryPoolMXBean bean : beans) {
        String name = bean.getName();
        PoolType type;
        if (contains(getCodeCacheNames(), name)) {
            type = PoolType.CODE_CACHE_USAGE;
        } else if (contains(getEdenNames(), name)) {
            type = PoolType.NEWGEN_USAGE;
        } else if (contains(getOldNames(), name)) {
            type = PoolType.OLDGEN_USAGE;
        } else if (contains(getSurvivorNames(), name)) {
            type = PoolType.SURVIVOR_USAGE;
        } else if (contains(getMetaspaceNames(), name)) {
            type = PoolType.METASPACE_USAGE;
        } else if (contains(getPermNames(), name)) {
            type = PoolType.PERMGEN_USAGE;
        } else {
            continue;
        }
        MemoryUsage usage = bean.getUsage();
        poolList.add(MemoryPool.newBuilder().setType(type).setInit(usage.getInit()).setMax(usage.getMax()).setCommited(usage.getCommitted()).setUsed(usage.getUsed()).build());
    }
    return poolList;
}
Also used : PoolType(org.apache.skywalking.apm.network.proto.PoolType) MemoryPoolMXBean(java.lang.management.MemoryPoolMXBean) MemoryUsage(java.lang.management.MemoryUsage) LinkedList(java.util.LinkedList) MemoryPool(org.apache.skywalking.apm.network.proto.MemoryPool)

Aggregations

MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)1 MemoryUsage (java.lang.management.MemoryUsage)1 LinkedList (java.util.LinkedList)1 MemoryPool (org.apache.skywalking.apm.network.proto.MemoryPool)1 PoolType (org.apache.skywalking.apm.network.proto.PoolType)1