Example usage for io.netty.buffer PoolArenaMetric numActiveBytes

List of usage examples for io.netty.buffer PoolArenaMetric numActiveBytes

Introduction

In this page you can find the example usage for io.netty.buffer PoolArenaMetric numActiveBytes.

Prototype

long numActiveBytes();

Source Link

Document

Return the number of active bytes that are currently allocated by the arena.

Usage

From source file:ratpack.dropwizard.metrics.internal.PooledByteBufAllocatorMetricSet.java

License:Apache License

private void initPoolArenaMetrics(final Iterator<PoolArenaMetric> poolArenasIterator) {
    int counter = 0;
    while (poolArenasIterator.hasNext()) {
        final PoolArenaMetric poolArenaMetric = poolArenasIterator.next();
        final String prefix = format("poolArena.%s", counter);

        metrics.put(format("%s.activeAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numActiveAllocations());
        metrics.put(format("%s.numActiveBytes", prefix), (Gauge<Long>) () -> poolArenaMetric.numActiveBytes());
        metrics.put(format("%s.numActiveHugeAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numActiveHugeAllocations());
        metrics.put(format("%s.numActiveNormalAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numActiveNormalAllocations());
        metrics.put(format("%s.numActiveSmallAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numActiveSmallAllocations());
        metrics.put(format("%s.numActiveTinyAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numActiveTinyAllocations());
        metrics.put(format("%s.numAllocations", prefix), (Gauge<Long>) () -> poolArenaMetric.numAllocations());
        metrics.put(format("%s.numDeallocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numDeallocations());
        metrics.put(format("%s.numHugeAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numHugeAllocations());
        metrics.put(format("%s.numHugeDeallocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numHugeDeallocations());
        metrics.put(format("%s.numNormalAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numNormalAllocations());
        metrics.put(format("%s.numNormalDeallocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numNormalDeallocations());
        metrics.put(format("%s.numSmallAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numSmallAllocations());
        metrics.put(format("%s.numSmallDeallocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numSmallDeallocations());
        metrics.put(format("%s.numTinyAllocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numTinyAllocations());
        metrics.put(format("%s.numTinyDeallocations", prefix),
                (Gauge<Long>) () -> poolArenaMetric.numTinyDeallocations());
        metrics.put(format("%s.numSmallSubpages", prefix),
                (Gauge<Integer>) () -> poolArenaMetric.numSmallSubpages());
        metrics.put(format("%s.numTinySubpages", prefix),
                (Gauge<Integer>) () -> poolArenaMetric.numTinySubpages());

        final Iterator<PoolChunkListMetric> chunksIterator = poolArenaMetric.chunkLists().iterator();
        initPoolChunkListMetrics(prefix, chunksIterator);

        final Iterator<PoolSubpageMetric> smallSubpagesIterator = poolArenaMetric.smallSubpages().iterator();
        initSubpageMetrics(prefix, "smallSubpage", smallSubpagesIterator);

        final Iterator<PoolSubpageMetric> tinySubpagesIterator = poolArenaMetric.tinySubpages().iterator();
        initSubpageMetrics(prefix, "tinySubpage", tinySubpagesIterator);

        counter++;/*from ww w  .j  ava 2s . c  o m*/
    }
}