Example usage for io.netty.buffer PoolSubpageMetric elementSize

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

Introduction

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

Prototype

int elementSize();

Source Link

Document

Return the size (in bytes) of the elements that will 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 ww. 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++;/*from www  .j  a va  2  s  .  c o m*/
    }
}