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);
}
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);
}
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);
}
}
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);
}
}
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()]);
}
Aggregations