Search in sources :

Example 6 with MonitorsCommand

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);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MonitorTableListIterator(com.ibm.j9ddr.vm29.j9.MonitorTableListIterator) MonitorTable(com.ibm.j9ddr.vm29.j9.MonitorTable)

Example 7 with MonitorsCommand

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);
    }
}
Also used : GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)6 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)6 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)3 MonitorTableListIterator (com.ibm.j9ddr.vm29.j9.MonitorTableListIterator)3 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)3 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)2 J9ObjectMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer)2 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)2 ICommand (com.ibm.j9ddr.tools.ddrinteractive.ICommand)1 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)1 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)1 J9ThreadLibraryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadLibraryPointer)1 J9ThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer)1 ACCommand (com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ACCommand)1 AllClassesCommand (com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.AllClassesCommand)1 AnalyseRomClassUTF8Command (com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.AnalyseRomClassUTF8Command)1 BuildFlagsCommand (com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.BuildFlagsCommand)1 BytecodesCommand (com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.BytecodesCommand)1