use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.
the class MonitorsCommand method tablesCommand.
/**
* See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
* function documentation
*
* @param args
* command args
* @param out
* the output stream
*/
private void tablesCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
try {
MonitorTableListIterator iterator = new MonitorTableListIterator();
MonitorTable previousMonitorTable = null;
while (iterator.hasNext()) {
MonitorTable currentMonitorTable = iterator.currentMonitorTable();
if (!currentMonitorTable.equals(previousMonitorTable)) {
/* Print header for new monitor table */
out.println(iterator.currentMonitorTable().extraInfo());
}
previousMonitorTable = currentMonitorTable;
iterator.next();
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.
the class MonitorsCommand method j9vmthreadCommand.
/**
* See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
* function documentation
*
* @param args
* command args
* @param out
* the output stream
* @throws DDRInteractiveCommandException
*/
private void j9vmthreadCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
if (args.length < 2) {
out.println("This command takes one address argument: \"!monitors j9vmthread <address>\"");
return;
}
try {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer thread = null;
GCVMThreadListIterator threadIterator = GCVMThreadListIterator.from();
while (threadIterator.hasNext()) {
if (ptr.equals(threadIterator.next())) {
thread = J9VMThreadPointer.cast(ptr);
}
}
if (null == thread) {
throw new DDRInteractiveCommandException(String.format("Could not find any j9vmthread at address %s\n", ptr.getHexAddress()));
}
// Step 1: Print the general info for the VM and native threads:
out.println(String.format("!j9vmthread 0x%08x\t!j9thread 0x%08x\t// %s", thread.getAddress(), thread.osThread().getAddress(), J9VMThreadHelper.getName(thread)));
printMonitorsForJ9VMThread(out, vm, thread);
printMonitorsForJ9Thread(out, vm, thread.osThread());
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations