abstract class PoolArena<T> extends java.lang.Object implements PoolArenaMetric
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PoolArena.DirectArena |
(package private) static class |
PoolArena.HeapArena |
(package private) static class |
PoolArena.SizeClass |
Modifier and Type | Field and Description |
---|---|
private LongCounter |
activeBytesHuge |
private LongCounter |
allocationsHuge |
private long |
allocationsNormal |
private LongCounter |
allocationsSmall |
private LongCounter |
allocationsTiny |
private java.util.List<PoolChunkListMetric> |
chunkListMetrics |
(package private) int |
chunkSize |
private LongCounter |
deallocationsHuge |
private long |
deallocationsNormal |
private long |
deallocationsSmall |
private long |
deallocationsTiny |
(package private) static boolean |
HAS_UNSAFE |
private int |
maxOrder |
(package private) int |
numSmallSubpagePools |
(package private) java.util.concurrent.atomic.AtomicInteger |
numThreadCaches |
(package private) static int |
numTinySubpagePools |
(package private) int |
pageShifts |
(package private) int |
pageSize |
(package private) PooledByteBufAllocator |
parent |
private PoolChunkList<T> |
q000 |
private PoolChunkList<T> |
q025 |
private PoolChunkList<T> |
q050 |
private PoolChunkList<T> |
q075 |
private PoolChunkList<T> |
q100 |
private PoolChunkList<T> |
qInit |
private PoolSubpage<T>[] |
smallSubpagePools |
(package private) int |
subpageOverflowMask |
private PoolSubpage<T>[] |
tinySubpagePools |
Modifier | Constructor and Description |
---|---|
protected |
PoolArena(PooledByteBufAllocator parent,
int pageSize,
int maxOrder,
int pageShifts,
int chunkSize) |
Modifier and Type | Method and Description |
---|---|
(package private) PooledByteBuf<T> |
allocate(PoolThreadCache cache,
int reqCapacity,
int maxCapacity) |
private void |
allocate(PoolThreadCache cache,
PooledByteBuf<T> buf,
int reqCapacity) |
private void |
allocateHuge(PooledByteBuf<T> buf,
int reqCapacity) |
private void |
allocateNormal(PooledByteBuf<T> buf,
int reqCapacity,
int normCapacity) |
private static void |
appendPoolSubPages(java.lang.StringBuilder buf,
PoolSubpage<?>[] subpages) |
java.util.List<PoolChunkListMetric> |
chunkLists()
Returns an unmodifiable
List which holds PoolChunkListMetric s. |
protected abstract void |
destroyChunk(PoolChunk<T> chunk) |
private void |
destroyPoolChunkLists(PoolChunkList<T>... chunkLists) |
private static void |
destroyPoolSubPages(PoolSubpage<?>[] pages) |
protected void |
finalize() |
(package private) PoolSubpage<T> |
findSubpagePoolHead(int elemSize) |
(package private) void |
free(PoolChunk<T> chunk,
long handle,
int normCapacity,
PoolThreadCache cache) |
(package private) void |
freeChunk(PoolChunk<T> chunk,
long handle,
PoolArena.SizeClass sizeClass) |
(package private) abstract boolean |
isDirect() |
(package private) static boolean |
isTiny(int normCapacity) |
(package private) boolean |
isTinyOrSmall(int normCapacity) |
protected abstract void |
memoryCopy(T src,
int srcOffset,
T dst,
int dstOffset,
int length) |
protected abstract PooledByteBuf<T> |
newByteBuf(int maxCapacity) |
protected abstract PoolChunk<T> |
newChunk(int pageSize,
int maxOrder,
int pageShifts,
int chunkSize) |
private PoolSubpage<T>[] |
newSubpagePoolArray(int size) |
private PoolSubpage<T> |
newSubpagePoolHead(int pageSize) |
protected abstract PoolChunk<T> |
newUnpooledChunk(int capacity) |
(package private) int |
normalizeCapacity(int reqCapacity) |
long |
numActiveAllocations()
Return the number of currently active allocations.
|
long |
numActiveBytes()
Return the number of active bytes that are currently allocated by the arena.
|
long |
numActiveHugeAllocations()
Return the number of currently active huge allocations.
|
long |
numActiveNormalAllocations()
Return the number of currently active normal allocations.
|
long |
numActiveSmallAllocations()
Return the number of currently active small allocations.
|
long |
numActiveTinyAllocations()
Return the number of currently active tiny allocations.
|
long |
numAllocations()
Return the number of allocations done via the arena.
|
int |
numChunkLists()
Returns the number of chunk lists for the arena.
|
long |
numDeallocations()
Return the number of deallocations done via the arena.
|
long |
numHugeAllocations()
Return the number of huge allocations done via the arena.
|
long |
numHugeDeallocations()
Return the number of huge deallocations done via the arena.
|
long |
numNormalAllocations()
Return the number of normal allocations done via the arena.
|
long |
numNormalDeallocations()
Return the number of normal deallocations done via the arena.
|
long |
numSmallAllocations()
Return the number of small allocations done via the arena.
|
long |
numSmallDeallocations()
Return the number of small deallocations done via the arena.
|
int |
numSmallSubpages()
Returns the number of small sub-pages for the arena.
|
int |
numThreadCaches()
Returns the number of thread caches backed by this arena.
|
long |
numTinyAllocations()
Return the number of tiny allocations done via the arena.
|
long |
numTinyDeallocations()
Return the number of tiny deallocations done via the arena.
|
int |
numTinySubpages()
Returns the number of tiny sub-pages for the arena.
|
(package private) void |
reallocate(PooledByteBuf<T> buf,
int newCapacity,
boolean freeOldMemory) |
private PoolArena.SizeClass |
sizeClass(int normCapacity) |
(package private) static int |
smallIdx(int normCapacity) |
java.util.List<PoolSubpageMetric> |
smallSubpages()
Returns an unmodifiable
List which holds PoolSubpageMetric s for small sub-pages. |
private static java.util.List<PoolSubpageMetric> |
subPageMetricList(PoolSubpage<?>[] pages) |
(package private) static int |
tinyIdx(int normCapacity) |
java.util.List<PoolSubpageMetric> |
tinySubpages()
Returns an unmodifiable
List which holds PoolSubpageMetric s for tiny sub-pages. |
java.lang.String |
toString() |
static final boolean HAS_UNSAFE
static final int numTinySubpagePools
final PooledByteBufAllocator parent
private final int maxOrder
final int pageSize
final int pageShifts
final int chunkSize
final int subpageOverflowMask
final int numSmallSubpagePools
private final PoolSubpage<T>[] tinySubpagePools
private final PoolSubpage<T>[] smallSubpagePools
private final PoolChunkList<T> q050
private final PoolChunkList<T> q025
private final PoolChunkList<T> q000
private final PoolChunkList<T> qInit
private final PoolChunkList<T> q075
private final PoolChunkList<T> q100
private final java.util.List<PoolChunkListMetric> chunkListMetrics
private long allocationsNormal
private final LongCounter allocationsTiny
private final LongCounter allocationsSmall
private final LongCounter allocationsHuge
private final LongCounter activeBytesHuge
private long deallocationsTiny
private long deallocationsSmall
private long deallocationsNormal
private final LongCounter deallocationsHuge
final java.util.concurrent.atomic.AtomicInteger numThreadCaches
protected PoolArena(PooledByteBufAllocator parent, int pageSize, int maxOrder, int pageShifts, int chunkSize)
private PoolSubpage<T> newSubpagePoolHead(int pageSize)
private PoolSubpage<T>[] newSubpagePoolArray(int size)
abstract boolean isDirect()
PooledByteBuf<T> allocate(PoolThreadCache cache, int reqCapacity, int maxCapacity)
static int tinyIdx(int normCapacity)
static int smallIdx(int normCapacity)
boolean isTinyOrSmall(int normCapacity)
static boolean isTiny(int normCapacity)
private void allocate(PoolThreadCache cache, PooledByteBuf<T> buf, int reqCapacity)
private void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity)
private void allocateHuge(PooledByteBuf<T> buf, int reqCapacity)
void free(PoolChunk<T> chunk, long handle, int normCapacity, PoolThreadCache cache)
private PoolArena.SizeClass sizeClass(int normCapacity)
void freeChunk(PoolChunk<T> chunk, long handle, PoolArena.SizeClass sizeClass)
PoolSubpage<T> findSubpagePoolHead(int elemSize)
int normalizeCapacity(int reqCapacity)
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory)
public int numThreadCaches()
public int numTinySubpages()
PoolArenaMetric
numTinySubpages
in interface PoolArenaMetric
public int numSmallSubpages()
PoolArenaMetric
numSmallSubpages
in interface PoolArenaMetric
public int numChunkLists()
PoolArenaMetric
numChunkLists
in interface PoolArenaMetric
public java.util.List<PoolSubpageMetric> tinySubpages()
PoolArenaMetric
List
which holds PoolSubpageMetric
s for tiny sub-pages.tinySubpages
in interface PoolArenaMetric
public java.util.List<PoolSubpageMetric> smallSubpages()
PoolArenaMetric
List
which holds PoolSubpageMetric
s for small sub-pages.smallSubpages
in interface PoolArenaMetric
public java.util.List<PoolChunkListMetric> chunkLists()
PoolArenaMetric
List
which holds PoolChunkListMetric
s.chunkLists
in interface PoolArenaMetric
private static java.util.List<PoolSubpageMetric> subPageMetricList(PoolSubpage<?>[] pages)
public long numAllocations()
PoolArenaMetric
numAllocations
in interface PoolArenaMetric
public long numTinyAllocations()
PoolArenaMetric
numTinyAllocations
in interface PoolArenaMetric
public long numSmallAllocations()
PoolArenaMetric
numSmallAllocations
in interface PoolArenaMetric
public long numNormalAllocations()
PoolArenaMetric
numNormalAllocations
in interface PoolArenaMetric
public long numDeallocations()
PoolArenaMetric
numDeallocations
in interface PoolArenaMetric
public long numTinyDeallocations()
PoolArenaMetric
numTinyDeallocations
in interface PoolArenaMetric
public long numSmallDeallocations()
PoolArenaMetric
numSmallDeallocations
in interface PoolArenaMetric
public long numNormalDeallocations()
PoolArenaMetric
numNormalDeallocations
in interface PoolArenaMetric
public long numHugeAllocations()
PoolArenaMetric
numHugeAllocations
in interface PoolArenaMetric
public long numHugeDeallocations()
PoolArenaMetric
numHugeDeallocations
in interface PoolArenaMetric
public long numActiveAllocations()
PoolArenaMetric
numActiveAllocations
in interface PoolArenaMetric
public long numActiveTinyAllocations()
PoolArenaMetric
numActiveTinyAllocations
in interface PoolArenaMetric
public long numActiveSmallAllocations()
PoolArenaMetric
numActiveSmallAllocations
in interface PoolArenaMetric
public long numActiveNormalAllocations()
PoolArenaMetric
numActiveNormalAllocations
in interface PoolArenaMetric
public long numActiveHugeAllocations()
PoolArenaMetric
numActiveHugeAllocations
in interface PoolArenaMetric
public long numActiveBytes()
PoolArenaMetric
numActiveBytes
in interface PoolArenaMetric
protected abstract PoolChunk<T> newChunk(int pageSize, int maxOrder, int pageShifts, int chunkSize)
protected abstract PooledByteBuf<T> newByteBuf(int maxCapacity)
protected abstract void memoryCopy(T src, int srcOffset, T dst, int dstOffset, int length)
public java.lang.String toString()
toString
in class java.lang.Object
private static void appendPoolSubPages(java.lang.StringBuilder buf, PoolSubpage<?>[] subpages)
protected final void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
private static void destroyPoolSubPages(PoolSubpage<?>[] pages)
private void destroyPoolChunkLists(PoolChunkList<T>... chunkLists)