use of com.ibm.j9ddr.tools.ddrinteractive.Table in project openj9 by eclipse.
the class ACCommand method dumpOwnedRegions.
private void dumpOwnedRegions(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
if (GCExtensions.isVLHGC()) {
Table table = new Table("Regions Owned by AC " + allocationContext.getHexAddress());
table.row("Region", "containsObjects");
GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
while (regionIterator.hasNext()) {
GCHeapRegionDescriptor region = regionIterator.next();
MM_HeapRegionDescriptorVLHGCPointer vlhgcRegion = MM_HeapRegionDescriptorVLHGCPointer.cast(region.getHeapRegionDescriptorPointer());
MM_AllocationContextTarokPointer currentAllocationContextTarok = vlhgcRegion._allocateData()._owningContext();
if (currentAllocationContextTarok.eq(allocationContext)) {
table.row("!mm_heapregiondescriptorvlhgc " + vlhgcRegion.getHexAddress(), Boolean.toString(region.containsObjects()));
}
}
table.render(out);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.Table in project openj9 by eclipse.
the class ObjectRefsCommand method dumpLiveReferences.
private void dumpLiveReferences(J9JavaVMPointer vm, J9ObjectPointer targetObject, PrintStream out) throws CorruptDataException {
MM_HeapRegionManagerPointer hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
GCHeapRegionManager heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
Table table = new Table("All Live Objects That Refer To !j9object " + targetObject.getHexAddress());
table.row("Object");
LiveSetWalker.walkLiveSet(new LiveReferenceVisitor(heapRegionManager, targetObject, table));
table.render(out);
}
use of com.ibm.j9ddr.tools.ddrinteractive.Table in project openj9 by eclipse.
the class ObjectSizeInfo method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
this.out = out;
fieldStats = new TreeMap<String, ClassFieldInfo>();
Table summary = new Table("Object field size summary");
summary.row(ClassFieldInfo.getTitleRow());
HeapFieldInfo hfi = new HeapFieldInfo();
if (args != null) {
if (!parseArgs(out, args)) {
return;
}
}
try {
scanHeap();
for (FieldInfo cfi : fieldStats.values()) {
summary.row(cfi.getResults());
hfi.addClass(cfi);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
summary.row(FieldInfo.getTitleRow());
try {
summary.row(hfi.getResults());
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
summary.render(out);
}
use of com.ibm.j9ddr.tools.ddrinteractive.Table in project openj9 by eclipse.
the class ACCommand method dumpLiveReferences.
private void dumpLiveReferences(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
if (GCExtensions.isVLHGC()) {
MM_AllocationContextTarokPointer act = MM_AllocationContextTarokPointer.cast(allocationContext);
MM_HeapRegionManagerPointer hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
GCHeapRegionManager heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
Table table = new Table("Live References into AC " + allocationContext.getHexAddress());
table.row("Object", "Field");
out.println("Walking live set in search of external references into ac: " + allocationContext.getHexAddress());
long totalMillis = System.currentTimeMillis();
LiveReferenceVisitor visitor = new LiveReferenceVisitor(heapRegionManager, act, table);
LiveSetWalker.walkLiveSet(visitor, RootSetType.ALL);
totalMillis = System.currentTimeMillis() - totalMillis;
table.render(out);
out.println("\nFinished live reference walk in " + totalMillis + "ms");
out.println("Found " + visitor.getNumExternalReferencesFound() + " external references.");
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.Table in project openj9 by eclipse.
the class ObjectRefsCommand method dumpHeapReferences.
/**
* Write the on heap references stanza to the output stream.
* @param vm
* @param targetObject
* @param out
* @throws CorruptDataException
*/
private void dumpHeapReferences(J9JavaVMPointer vm, J9ObjectPointer targetObject, PrintStream out) throws CorruptDataException {
if (GCExtensions.isVLHGC()) {
Table table = new Table("On Heap References");
table.row("object (!j9object)", "field (!j9object)", "!mm_heapregiondescriptorvlhgc", "AC (type)");
/* iterate over all heap regions */
GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
while (regionIterator.hasNext()) {
GCHeapRegionDescriptor region = regionIterator.next();
if (region.containsObjects()) {
MM_HeapRegionDescriptorVLHGCPointer vlhgcRegion = MM_HeapRegionDescriptorVLHGCPointer.cast(region.getHeapRegionDescriptorPointer());
MM_AllocationContextTarokPointer currentAllocationContextTarok = vlhgcRegion._allocateData()._owningContext();
/* iterate over all objects in region */
GCObjectHeapIterator heapObjectIterator = region.objectIterator(true, false);
while (heapObjectIterator.hasNext()) {
J9ObjectPointer currentObject = heapObjectIterator.next();
/* Iterate over the object's fields and list any that point at @ref targetObject */
GCObjectIterator fieldIterator = GCObjectIterator.fromJ9Object(currentObject, false);
while (fieldIterator.hasNext()) {
J9ObjectPointer currentTargetObject = fieldIterator.next();
if (currentTargetObject.eq(targetObject)) {
/* found a reference to our targetObject, add it to the table */
J9ClassPointer objectClass = J9ObjectHelper.clazz(currentObject);
String objectClassString = J9ClassHelper.getJavaName(objectClass);
table.row(currentObject.getHexAddress() + " //" + objectClassString, currentTargetObject.getHexAddress(), vlhgcRegion.getHexAddress(), currentAllocationContextTarok.getHexAddress() + " (" + currentAllocationContextTarok._allocationContextType() + ")");
}
}
}
}
}
table.render(out);
}
}
Aggregations