Example usage for io.netty.buffer PoolSubpageMetric numAvailable

List of usage examples for io.netty.buffer PoolSubpageMetric numAvailable

Introduction

In this page you can find the example usage for io.netty.buffer PoolSubpageMetric numAvailable.

Prototype

int numAvailable();

Source Link

Document

Return the number of available elements to be allocated.

Usage

From source file:com.yahoo.pulsar.broker.stats.AllocatorStatsGenerator.java

License:Apache License

private static PoolSubpageStats newPoolSubpageStats(PoolSubpageMetric m) {
    PoolSubpageStats stats = new PoolSubpageStats();
    stats.maxNumElements = m.maxNumElements();
    stats.numAvailable = m.numAvailable();
    stats.elementSize = m.elementSize();
    stats.pageSize = m.pageSize();//from   w w w . j a  v  a 2 s  .  c  o  m
    return stats;
}

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

License:Apache License

private void initSubpageMetrics(final String prefix, final String subpageName,
        final Iterator<PoolSubpageMetric> subpagesIterator) {
    int counter = 0;
    while (subpagesIterator.hasNext()) {
        final PoolSubpageMetric poolSubpageMetric = subpagesIterator.next();

        final String subpagePrefix = format("%s.%s", subpageName, counter);

        metrics.put(format("%s.%s.elementSize", prefix, subpagePrefix),
                (Gauge<Integer>) () -> poolSubpageMetric.elementSize());
        metrics.put(format("%s.%s.maxNumElements", prefix, subpagePrefix),
                (Gauge<Integer>) () -> poolSubpageMetric.maxNumElements());
        metrics.put(format("%s.%s.numAvailable", prefix, subpagePrefix),
                (Gauge<Integer>) () -> poolSubpageMetric.numAvailable());
        metrics.put(format("%s.%s.pageSize", prefix, subpagePrefix),
                (Gauge<Integer>) () -> poolSubpageMetric.pageSize());

        counter++;/*  w  w  w.j  a  va2 s . co m*/
    }
}