Home / Class/ SimpleByteBufPooledAllocatorBenchmark Class — netty Architecture

SimpleByteBufPooledAllocatorBenchmark Class — netty Architecture

Architecture documentation for the SimpleByteBufPooledAllocatorBenchmark class in SimpleByteBufPooledAllocatorBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f10e86a9_beff_46df_386d_e6974fa256e0["SimpleByteBufPooledAllocatorBenchmark"]
  d3fe4490_78c4_c6d8_bc2c_a2ac3e74297f["SimpleByteBufPooledAllocatorBenchmark.java"]
  f10e86a9_beff_46df_386d_e6974fa256e0 -->|defined in| d3fe4490_78c4_c6d8_bc2c_a2ac3e74297f
  3e0553c1_df07_8d52_cb2e_f3955f8dad33["SimpleByteBufPooledAllocatorBenchmark()"]
  f10e86a9_beff_46df_386d_e6974fa256e0 -->|method| 3e0553c1_df07_8d52_cb2e_f3955f8dad33
  cd77c0b1_8c45_409a_7a58_26e617042ee0["doSetup()"]
  f10e86a9_beff_46df_386d_e6974fa256e0 -->|method| cd77c0b1_8c45_409a_7a58_26e617042ee0
  c2a5f154_d18e_811a_819c_23b9bb53b6a9["getAndRelease()"]
  f10e86a9_beff_46df_386d_e6974fa256e0 -->|method| c2a5f154_d18e_811a_819c_23b9bb53b6a9

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/SimpleByteBufPooledAllocatorBenchmark.java lines 35–91

@State(Scope.Benchmark)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class SimpleByteBufPooledAllocatorBenchmark extends AbstractMicrobenchmark {

    public SimpleByteBufPooledAllocatorBenchmark() {
        super(true, false);
    }

    @Param({
            "123",
            "1234",
            "12345",
            "123456",
            "1234567",
    })
    public int size;

    @Param({
            "0",
            "5",
            "10",
            "100",
    })
    public long tokens;

    @Param({
            "true",
            "false",
    })
    public boolean useThreadCache;

    public ByteBufAllocator allocator;

    @Setup(Level.Trial)
    public void doSetup() {
        allocator = new PooledByteBufAllocator(
                PooledByteBufAllocator.defaultPreferDirect(),
                PooledByteBufAllocator.defaultNumHeapArena(),
                PooledByteBufAllocator.defaultNumDirectArena(),
                PooledByteBufAllocator.defaultPageSize(),
                PooledByteBufAllocator.defaultMaxOrder(),
                PooledByteBufAllocator.defaultTinyCacheSize(),
                PooledByteBufAllocator.defaultSmallCacheSize(),
                PooledByteBufAllocator.defaultNormalCacheSize(),
                useThreadCache);
    }

    @Benchmark
    public boolean getAndRelease() {
        ByteBuf buf = allocator.directBuffer(size);
        if (tokens > 0) {
            Blackhole.consumeCPU(tokens);
        }
        return buf.release();
    }
}

Frequently Asked Questions

What is the SimpleByteBufPooledAllocatorBenchmark class?
SimpleByteBufPooledAllocatorBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/SimpleByteBufPooledAllocatorBenchmark.java.
Where is SimpleByteBufPooledAllocatorBenchmark defined?
SimpleByteBufPooledAllocatorBenchmark is defined in microbench/src/main/java/io/netty/microbench/buffer/SimpleByteBufPooledAllocatorBenchmark.java at line 35.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free