Search in sources :

Example 1 with J9MonitorTableListEntryPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer in project openj9 by eclipse.

the class MonitorsCommand method tableCommand.

/**
 * See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
 * function documentation
 *
 * @param args
 *            command args
 * @param out
 *            the output stream
 * @throws DDRInteractiveCommandException
 */
private void tableCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
    FilterOptions filter = FilterOptions.defaultOption();
    if (args.length > 2) {
        filter = FilterOptions.parseOption(args[2]);
    } else if (args.length == 2) {
        out.println("No filter specified, defaulting to 'active' monitors.");
    } else if (args.length < 2) {
        out.println("This command takes one address argument: \"!monitors table <address>\"");
        return;
    }
    try {
        StringBuilder builder = new StringBuilder();
        long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        VoidPointer ptr = VoidPointer.cast(address);
        MonitorTableListIterator iterator = new MonitorTableListIterator();
        boolean foundTable = false;
        while (iterator.hasNext()) {
            J9ObjectMonitorPointer objectMonitorPointer = iterator.next();
            MonitorTable currentMonitorTable = iterator.currentMonitorTable();
            if (currentMonitorTable.getMonitorTableListEntryPointer().equals(ptr)) {
                tablePrintHelper(filter, builder, objectMonitorPointer);
                foundTable = true;
            }
        }
        out.append(builder);
        if (false == foundTable) {
            out.append(String.format("Could not find any J9MonitorTableListEntryPointer at address %s\n", ptr.getHexAddress()));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ObjectMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MonitorTableListIterator(com.ibm.j9ddr.vm29.j9.MonitorTableListIterator) MonitorTable(com.ibm.j9ddr.vm29.j9.MonitorTable)

Example 2 with J9MonitorTableListEntryPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer in project openj9 by eclipse.

the class MonitorTableList method initializeCaches.

private static synchronized void initializeCaches() throws CorruptDataException {
    if (!initialized) {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        PointerPointer cursor = vm.monitorTables();
        int count = vm.monitorTableCount().intValue();
        monitorTables = new MonitorTable[count];
        for (int i = 0; i < count; i++) {
            J9MonitorTableListEntryPointer entries = vm.monitorTableList();
            while (entries.notNull()) {
                if (entries.monitorTable().eq(cursor.at(i))) {
                    monitorTables[i] = MonitorTable.from(entries);
                    break;
                }
                entries = entries.next();
            }
        }
        initialized = true;
    }
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9MonitorTableListEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer)

Example 3 with J9MonitorTableListEntryPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer in project openj9 by eclipse.

the class MonitorTableListIterator method hasNext.

/**
 * @see SlotIterator
 */
public boolean hasNext() {
    while (true) {
        if (localIterator.hasNext()) {
            return true;
        } else {
            J9MonitorTableListEntryPointer entry = currentMonitorTable.getMonitorTableListEntryPointer();
            try {
                entry = entry.next();
                if (entry.notNull()) {
                    currentMonitorTable = MonitorTable.from(entry);
                    localIterator = currentMonitorTable.iterator();
                } else {
                    return false;
                }
            } catch (CorruptDataException e) {
                e.printStackTrace();
                return false;
            }
        }
    }
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9MonitorTableListEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 J9MonitorTableListEntryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MonitorTableListEntryPointer)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)1 MonitorTableListIterator (com.ibm.j9ddr.vm29.j9.MonitorTableListIterator)1 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9ObjectMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer)1