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 | Constructor and Description |
|---|---|
protected |
PoolArena(PooledByteBufAllocator parent,
int pageSize,
int maxOrder,
int pageShifts,
int chunkSize,
int cacheAlignment) |
| Modifier and Type | Method and Description |
|---|---|
(package private) int |
alignCapacity(int reqCapacity) |
(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 PoolChunkListMetrics. |
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) |
private void |
incTinySmallAllocation(boolean tiny) |
(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 PoolSubpageMetrics 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 PoolSubpageMetrics 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
final int directMemoryCacheAlignment
final int directMemoryCacheAlignmentMask
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, int cacheAlignment)
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 incTinySmallAllocation(boolean tiny)
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)
int alignCapacity(int reqCapacity)
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory)
public int numThreadCaches()
PoolArenaMetricnumThreadCaches in interface PoolArenaMetricpublic int numTinySubpages()
PoolArenaMetricnumTinySubpages in interface PoolArenaMetricpublic int numSmallSubpages()
PoolArenaMetricnumSmallSubpages in interface PoolArenaMetricpublic int numChunkLists()
PoolArenaMetricnumChunkLists in interface PoolArenaMetricpublic java.util.List<PoolSubpageMetric> tinySubpages()
PoolArenaMetricList which holds PoolSubpageMetrics for tiny sub-pages.tinySubpages in interface PoolArenaMetricpublic java.util.List<PoolSubpageMetric> smallSubpages()
PoolArenaMetricList which holds PoolSubpageMetrics for small sub-pages.smallSubpages in interface PoolArenaMetricpublic java.util.List<PoolChunkListMetric> chunkLists()
PoolArenaMetricList which holds PoolChunkListMetrics.chunkLists in interface PoolArenaMetricprivate static java.util.List<PoolSubpageMetric> subPageMetricList(PoolSubpage<?>[] pages)
public long numAllocations()
PoolArenaMetricnumAllocations in interface PoolArenaMetricpublic long numTinyAllocations()
PoolArenaMetricnumTinyAllocations in interface PoolArenaMetricpublic long numSmallAllocations()
PoolArenaMetricnumSmallAllocations in interface PoolArenaMetricpublic long numNormalAllocations()
PoolArenaMetricnumNormalAllocations in interface PoolArenaMetricpublic long numDeallocations()
PoolArenaMetricnumDeallocations in interface PoolArenaMetricpublic long numTinyDeallocations()
PoolArenaMetricnumTinyDeallocations in interface PoolArenaMetricpublic long numSmallDeallocations()
PoolArenaMetricnumSmallDeallocations in interface PoolArenaMetricpublic long numNormalDeallocations()
PoolArenaMetricnumNormalDeallocations in interface PoolArenaMetricpublic long numHugeAllocations()
PoolArenaMetricnumHugeAllocations in interface PoolArenaMetricpublic long numHugeDeallocations()
PoolArenaMetricnumHugeDeallocations in interface PoolArenaMetricpublic long numActiveAllocations()
PoolArenaMetricnumActiveAllocations in interface PoolArenaMetricpublic long numActiveTinyAllocations()
PoolArenaMetricnumActiveTinyAllocations in interface PoolArenaMetricpublic long numActiveSmallAllocations()
PoolArenaMetricnumActiveSmallAllocations in interface PoolArenaMetricpublic long numActiveNormalAllocations()
PoolArenaMetricnumActiveNormalAllocations in interface PoolArenaMetricpublic long numActiveHugeAllocations()
PoolArenaMetricnumActiveHugeAllocations in interface PoolArenaMetricpublic long numActiveBytes()
PoolArenaMetricnumActiveBytes in interface PoolArenaMetricprotected 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.Objectprivate static void appendPoolSubPages(java.lang.StringBuilder buf,
PoolSubpage<?>[] subpages)
protected final void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprivate static void destroyPoolSubPages(PoolSubpage<?>[] pages)
private void destroyPoolChunkLists(PoolChunkList<T>... chunkLists)