use of com.ibm.j9ddr.vm29.pointer.generated.MM_MemoryPoolAggregatedCellListPointer in project openj9 by eclipse.
the class DumpSegregatedStatsCommand method getFreeCellCount.
/**
* Count the number of free cells in the MM_HeapRegionDescriptorSegregatedPointer freelist
* @throws CorruptDataException
*/
public long getFreeCellCount(MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptor) throws CorruptDataException {
/* TODO assumes a small region */
MM_MemoryPoolAggregatedCellListPointer memoryPoolACL = heapRegionDescriptor._memoryPoolACL();
GCHeapLinkedFreeHeader heapLinkedFreeHeader = GCHeapLinkedFreeHeader.fromLinkedFreeHeaderPointer(memoryPoolACL._freeListHead());
/* Get the size classes */
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMGCSizeClassesPointer sizeClasses = vm.realtimeSizeClasses();
UDATA sizeClassIndex = heapRegionDescriptor._sizeClass();
long cellSize = sizeClasses.smallCellSizesEA().at(sizeClassIndex).longValue();
long freeCellCount = 0;
while (heapLinkedFreeHeader.getHeader().notNull()) {
freeCellCount += heapLinkedFreeHeader.getSize().longValue() / cellSize;
heapLinkedFreeHeader = heapLinkedFreeHeader.getNext();
}
return freeCellCount;
}
Aggregations