use of com.ibm.j9ddr.vm29.j9.MonitorTable in project openj9 by eclipse.
the class MonitorsCommand method objectsCommand.
private void objectsCommand(FilterOptions filter, PrintStream out) throws DDRInteractiveCommandException {
try {
HashSet<ObjectMonitor> monitors = new HashSet<ObjectMonitor>();
MonitorTableListIterator iterator = new MonitorTableListIterator();
MonitorTable previousMonitorTable = null;
StringBuilder builder = new StringBuilder();
while (iterator.hasNext()) {
J9ObjectMonitorPointer objectMonitorPointer = iterator.next();
MonitorTable currentMonitorTable = iterator.currentMonitorTable();
ObjectMonitor found = tablePrintHelper(filter, builder, objectMonitorPointer);
if (null != found) {
monitors.add(found);
}
if (!currentMonitorTable.equals(previousMonitorTable) && (builder.length() > 0)) {
/* Print header for new monitor table */
if (null != previousMonitorTable) {
out.println();
}
out.println(iterator.currentMonitorTable().extraInfo());
previousMonitorTable = currentMonitorTable;
}
out.append(builder);
builder.setLength(0);
}
// Don't forget leftover flatlocked monitors on heap, these have no associated table:
Iterator<ObjectMonitor> flatMonitorIterator = HeapWalker.getFlatLockedMonitors().iterator();
while (flatMonitorIterator.hasNext()) {
ObjectMonitor objMon = flatMonitorIterator.next();
if (!monitors.contains(objMon)) {
writeObjectMonitorToBuffer(filter, objMon, builder);
}
}
if (builder.length() > 0) {
out.append("<Flatlocked Monitors on Heap>\n");
out.append(builder);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.j9.MonitorTable in project openj9 by eclipse.
the class CheckMonitorTable method print.
@Override
public void print() {
try {
VoidPointer monitorTableList = VoidPointer.cast(getJavaVM().monitorTableList());
GCMonitorReferenceIterator monitorReferenceIterator = GCMonitorReferenceIterator.from();
MonitorTable previousMonitorTable = null;
ScanFormatter formatter = new ScanFormatter(this, "MonitorTableList", monitorTableList);
while (monitorReferenceIterator.hasNext()) {
J9ObjectMonitorPointer objectMonitor = monitorReferenceIterator.next();
MonitorTable currentMonitorTable = monitorReferenceIterator.currentMonitorTable();
if (!currentMonitorTable.equals(previousMonitorTable)) {
if (null != previousMonitorTable) {
formatter.endSection();
}
formatter.section("MonitorTable", currentMonitorTable.getMonitorTableListEntryPointer());
}
J9ThreadAbstractMonitorPointer monitor = J9ThreadAbstractMonitorPointer.cast(objectMonitor.monitor());
formatter.entry(VoidPointer.cast(monitor.userData()));
previousMonitorTable = currentMonitorTable;
}
if (null != previousMonitorTable) {
formatter.endSection();
}
formatter.end("MonitorTableList", monitorTableList);
} catch (CorruptDataException e) {
// TODO: handle exception
}
}
Aggregations