Search in sources :

Example 1 with MM_HeapRegionDescriptorSegregatedPointer

use of com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer in project openj9 by eclipse.

the class DumpSegregatedStatsCommand method getTotalRegions.

/**
 * Based off of MM_HeapRegionQueue::getTotalRegions. Returns the number of regions.
 * This function will calculate the number of regions differently according to the type of
 * the actual subclass.
 * @throws CorruptDataException
 */
public long getTotalRegions(MM_HeapRegionListPointer heapRegionList) throws CorruptDataException {
    long count = 0;
    StructurePointer heapRegionQueue = heapRegionList.getAsRuntimeType();
    if (heapRegionQueue instanceof MM_LockingHeapRegionQueuePointer) {
        MM_LockingHeapRegionQueuePointer lockingHeapRegionQueue = (MM_LockingHeapRegionQueuePointer) heapRegionQueue;
        if (lockingHeapRegionQueue._singleRegionsOnly()) {
            count = lockingHeapRegionQueue._length().longValue();
        } else {
            MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingHeapRegionQueue._head();
            while (heapRegionDescriptorSegregated.notNull()) {
                count += heapRegionDescriptorSegregated._regionsInSpan().longValue();
                heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
            }
        }
    } else if (heapRegionQueue instanceof MM_LockingFreeHeapRegionListPointer) {
        MM_LockingFreeHeapRegionListPointer lockingFreeHeapRegionQueue = (MM_LockingFreeHeapRegionListPointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingFreeHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            count += heapRegionDescriptorSegregated._regionsInSpan().longValue();
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else {
        throw new CorruptDataException("Bad HeapRegionList type");
    }
    return count;
}
Also used : MM_LockingHeapRegionQueuePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer) MM_HeapRegionDescriptorSegregatedPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer) StructurePointer(com.ibm.j9ddr.vm29.pointer.StructurePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_LockingFreeHeapRegionListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)

Example 2 with MM_HeapRegionDescriptorSegregatedPointer

use of com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer in project openj9 by eclipse.

the class DumpSegregatedStatsCommand method getFreeCellCount.

/**
 * Count the number of free cells in the entire MM_HeapRegionList
 * @throws CorruptDataException
 */
public long getFreeCellCount(MM_HeapRegionListPointer heapRegionList) throws CorruptDataException {
    StructurePointer heapRegionQueue = heapRegionList.getAsRuntimeType();
    long freeCellCount = 0;
    if (heapRegionQueue instanceof MM_LockingHeapRegionQueuePointer) {
        MM_LockingHeapRegionQueuePointer lockingHeapRegionQueue = (MM_LockingHeapRegionQueuePointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            freeCellCount += getFreeCellCount(heapRegionDescriptorSegregated);
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else if (heapRegionQueue instanceof MM_LockingFreeHeapRegionListPointer) {
        MM_LockingFreeHeapRegionListPointer lockingFreeHeapRegionQueue = (MM_LockingFreeHeapRegionListPointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingFreeHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            freeCellCount += getFreeCellCount(heapRegionDescriptorSegregated);
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else {
        throw new CorruptDataException("Bad HeapRegionList type");
    }
    return freeCellCount;
}
Also used : MM_LockingHeapRegionQueuePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer) MM_HeapRegionDescriptorSegregatedPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer) StructurePointer(com.ibm.j9ddr.vm29.pointer.StructurePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_LockingFreeHeapRegionListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)

Example 3 with MM_HeapRegionDescriptorSegregatedPointer

use of com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer 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;
}
Also used : MM_MemoryPoolAggregatedCellListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MemoryPoolAggregatedCellListPointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9VMGCSizeClassesPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSizeClassesPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) GCHeapLinkedFreeHeader(com.ibm.j9ddr.vm29.j9.gc.GCHeapLinkedFreeHeader)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 StructurePointer (com.ibm.j9ddr.vm29.pointer.StructurePointer)2 MM_HeapRegionDescriptorSegregatedPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer)2 MM_LockingFreeHeapRegionListPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)2 MM_LockingHeapRegionQueuePointer (com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer)2 GCHeapLinkedFreeHeader (com.ibm.j9ddr.vm29.j9.gc.GCHeapLinkedFreeHeader)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9VMGCSizeClassesPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSizeClassesPointer)1 MM_MemoryPoolAggregatedCellListPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_MemoryPoolAggregatedCellListPointer)1 UDATA (com.ibm.j9ddr.vm29.types.UDATA)1