Search in sources :

Example 1 with J9MemorySegmentListPointer

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

the class SegmentsUtil method dbgDumpJITCodeSegmentList.

public static void dbgDumpJITCodeSegmentList(PrintStream out, J9MemorySegmentListPointer segmentListPointer) throws CorruptDataException {
    String fmt = null;
    if (J9BuildFlags.env_data64) {
        out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
        out.append("|    segment     |     start      |    warmAlloc   |    coldAlloc   |      end       |  size  |\n");
        out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
        fmt = " %016x %016x %016x %016x %016x %8x";
    } else {
        out.append("+--------+--------+--------+--------+--------+--------+\n");
        out.append("|segment | start  |  warm  |  cold  |  end   |  size  |\n");
        out.append("+--------+--------+--------+--------+--------+--------+\n");
        fmt = " %08x %08x %08x %08x %08x %8x";
    }
    MemorySegmentIterator segmentIterator = new MemorySegmentIterator(segmentListPointer, MemorySegmentIterator.MEMORY_ALL_TYPES, false);
    long totalMemory = 0L, totalMemoryInUse = 0L;
    while (segmentIterator.hasNext()) {
        J9MemorySegmentPointer seg = (J9MemorySegmentPointer) segmentIterator.next();
        final UDATA heapBase = UDATAPointer.cast(seg.heapBase()).at(0);
        long warmAlloc = UDATAPointer.cast(heapBase).at(0).longValue();
        long coldAlloc = UDATAPointer.cast(heapBase.add(UDATA.SIZEOF)).at(0).longValue();
        totalMemory += seg.size().longValue();
        totalMemoryInUse += (warmAlloc - seg.heapBase().longValue()) + (seg.heapTop().longValue() - coldAlloc);
        String msg = String.format(fmt, seg.getAddress(), seg.heapBase().getAddress(), warmAlloc, coldAlloc, seg.heapTop().getAddress(), seg.size().longValue());
        out.append(msg);
        out.append(nl);
        seg = segmentListPointer.nextSegment();
    }
    if (J9BuildFlags.env_data64) {
        out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
    } else {
        out.append("+--------+--------+--------+--------+--------+--------+\n");
    }
    printMemoryUsed(out, totalMemory, totalMemoryInUse);
    out.append(nl);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) MemorySegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.MemorySegmentIterator)

Example 2 with J9MemorySegmentListPointer

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

the class SegmentsUtil method dbgDumpSegmentList.

public static void dbgDumpSegmentList(PrintStream out, J9MemorySegmentListPointer segmentListPointer) throws CorruptDataException {
    String fmt = null;
    if (J9BuildFlags.env_data64) {
        out.append("+----------------+----------------+----------------+----------------+--------+--------+\n");
        out.append("|    segment     |     start      |     alloc      |      end       |  type  |  size  |\n");
        out.append("+----------------+----------------+----------------+----------------+--------+--------+\n");
        fmt = " %016x %016x %016x %016x %08x %8x";
    } else {
        out.append("+--------+--------+--------+--------+--------+--------+\n");
        out.append("|segment | start  | alloc  |  end   |  type  |  size  |\n");
        out.append("+--------+--------+--------+--------+--------+--------+\n");
        fmt = " %08x %08x %08x %08x %08x %8x";
    }
    MemorySegmentIterator segmentIterator = new MemorySegmentIterator(segmentListPointer, MemorySegmentIterator.MEMORY_ALL_TYPES, false);
    long totalMemory = 0L, totalMemoryInUse = 0L;
    while (segmentIterator.hasNext()) {
        J9MemorySegmentPointer seg = (J9MemorySegmentPointer) segmentIterator.next();
        totalMemory += seg.size().longValue();
        totalMemoryInUse += seg.heapAlloc().sub(seg.heapBase()).longValue();
        String msg = String.format(fmt, seg.getAddress(), seg.heapBase().getAddress(), seg.heapAlloc().getAddress(), seg.heapTop().getAddress(), seg.type().longValue(), seg.size().longValue());
        out.append(msg);
        out.append(nl);
        seg = segmentListPointer.nextSegment();
    }
    if (J9BuildFlags.env_data64) {
        out.append("+----------------+----------------+----------------+----------------+--------+--------+\n");
    } else {
        out.append("+--------+--------+--------+--------+--------+--------+\n");
    }
    printMemoryUsed(out, totalMemory, totalMemoryInUse);
    out.append(nl);
}
Also used : MemorySegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.MemorySegmentIterator)

Example 3 with J9MemorySegmentListPointer

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

the class DumpSegmentsInListCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
        J9MemorySegmentListPointer list = J9MemorySegmentListPointer.cast(address);
        SegmentsUtil.dbgDumpSegmentList(out, list);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9MemorySegmentListPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentListPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 4 with J9MemorySegmentListPointer

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

the class SegmentsUtil method addSegmentsToArrayList.

private static void addSegmentsToArrayList(J9MemorySegmentListPointer segmentListPointer, ArrayList<J9MemorySegmentPointer> segmentArray, int segmentType) throws CorruptDataException {
    MemorySegmentIterator segmentIterator = new MemorySegmentIterator(segmentListPointer, segmentType, false);
    while (segmentIterator.hasNext()) {
        J9MemorySegmentPointer seg = (J9MemorySegmentPointer) segmentIterator.next();
        segmentArray.add(seg);
    }
}
Also used : MemorySegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.MemorySegmentIterator)

Example 5 with J9MemorySegmentListPointer

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

the class SegmentTree method setSegmentList.

protected void setSegmentList(J9MemorySegmentListPointer segmentList) {
    ArrayList<J9MemorySegmentPointer> segments = new ArrayList<J9MemorySegmentPointer>();
    try {
        // Batch up the entries
        GCSegmentIterator iterator = GCSegmentIterator.fromJ9MemorySegmentList(segmentList, 0);
        while (iterator.hasNext()) {
            segments.add(iterator.next());
        }
    } catch (CorruptDataException e) {
        EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
        cache = new J9MemorySegmentPointer[0];
    }
    // And sort them
    Collections.sort(segments, new Comparator<J9MemorySegmentPointer>() {

        public int compare(J9MemorySegmentPointer seg1, J9MemorySegmentPointer seg2) {
            try {
                return seg1.eq(seg2) ? 0 : seg1.heapBase().lt(seg2.heapBase()) ? -1 : 1;
            } catch (CorruptDataException e) {
                EventManager.raiseCorruptDataEvent("Corrupted segment in list", e, false);
                return -1;
            }
        }
    });
    cache = segments.toArray(new J9MemorySegmentPointer[segments.size()]);
}
Also used : ArrayList(java.util.ArrayList) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) GCSegmentIterator(com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)3 MemorySegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.MemorySegmentIterator)3 J9MemorySegmentListPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentListPointer)2 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)2 UDATA (com.ibm.j9ddr.vm29.types.UDATA)2 ArrayList (java.util.ArrayList)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 GCSegmentIterator (com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)1 J9JITDataCacheHeaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITDataCacheHeaderPointer)1 J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)1 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)1 List (java.util.List)1