doSetup() — netty Function Reference
Architecture documentation for the doSetup() function in PooledByteBufAllocatorAlignBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 613a6e78_2820_8e58_c371_53e5fca55dff["doSetup()"] f2a6748b_3f45_bdff_ac0b_1ebe34c917f2["PooledByteBufAllocatorAlignBenchmark"] 613a6e78_2820_8e58_c371_53e5fca55dff -->|defined in| f2a6748b_3f45_bdff_ac0b_1ebe34c917f2 style 613a6e78_2820_8e58_c371_53e5fca55dff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/buffer/PooledByteBufAllocatorAlignBenchmark.java lines 84–118
@Setup
public void doSetup() {
PooledByteBufAllocator pooledAllocator = new PooledByteBufAllocator(true, 4, 4, 8192, 11, 0,
0, 0, true, cacheAlign);
pooledDirectBuffer = pooledAllocator.directBuffer(size + 64);
sizeMask = size - 1;
if (cacheAlign == 0) {
long addr = pooledDirectBuffer.memoryAddress();
// make sure address is miss-aligned
if (addr % 64 == 0) {
alignOffset = 63;
}
int off = 0;
for (int c = 0; c < size; c++) {
off = (off + OFFSET_ADD) & sizeMask;
if ((addr + off + alignOffset) % BLOCK == 0) {
throw new IllegalStateException(
"Misaligned address is not really aligned");
}
}
} else {
alignOffset = 0;
int off = 0;
long addr = pooledDirectBuffer.memoryAddress();
for (int c = 0; c < size; c++) {
off = (off + OFFSET_ADD) & sizeMask;
if ((addr + off) % BLOCK != 0) {
throw new IllegalStateException(
"Aligned address is not really aligned");
}
}
}
bytes = new byte[BLOCK];
rand.nextBytes(bytes);
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does doSetup() do?
doSetup() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/PooledByteBufAllocatorAlignBenchmark.java.
Where is doSetup() defined?
doSetup() is defined in microbench/src/main/java/io/netty/microbench/buffer/PooledByteBufAllocatorAlignBenchmark.java at line 84.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free