Search in sources :

Example 1 with MonitorsCommand

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.

the class GetCommandsTask method run.

/*
	 * (non-Javadoc)
	 * 
	 * @see com.ibm.j9ddr.IBootstrapRunnable#run(com.ibm.j9ddr.IVMData,
	 * java.lang.Object[])
	 */
public void run(IVMData vmData, Object[] userData) {
    Object[] passbackArray = (Object[]) userData[0];
    Object loader = (Object) passbackArray[1];
    List<ICommand> toPassBack = getBaseJVMCommands();
    toPassBack.add(new StackWalkCommand());
    toPassBack.add(new StructureCommand());
    toPassBack.add(new ThreadsCommand());
    toPassBack.add(new ACCommand());
    toPassBack.add(new AllClassesCommand());
    toPassBack.add(new ITableSizeCommand());
    toPassBack.add(new BuildFlagsCommand());
    toPassBack.add(new WalkInternTableCommand());
    toPassBack.add(new ClassForNameCommand());
    toPassBack.add(new DumpAllClassloadersCommand());
    toPassBack.add(new DumpAllRegionsCommand());
    toPassBack.add(new DumpAllSegmentsCommand());
    toPassBack.add(new FindOverlappingSegmentsCommand());
    toPassBack.add(new FindStackValueCommand());
    toPassBack.add(new VmCheckCommand());
    toPassBack.add(new DumpRomClassCommand());
    toPassBack.add(new WhatIsCommand());
    toPassBack.add(new DumpRamClassLinearCommand());
    toPassBack.add(new DumpRomClassLinearCommand());
    toPassBack.add(new DumpRomMethodCommand());
    toPassBack.add(new DumpAllRomClassLinearCommand());
    toPassBack.add(new DumpAllRamClassLinearCommand());
    toPassBack.add(new VMConstantPoolCommand());
    toPassBack.add(new J9VTablesCommand());
    toPassBack.add(new MethodForNameCommand());
    toPassBack.add(new BytecodesCommand());
    toPassBack.add(new FindPatternCommand());
    toPassBack.add(new JitMetadataFromPcCommand());
    toPassBack.add(new FindMethodFromPcCommand());
    toPassBack.add(new DumpSegmentsInListCommand());
    toPassBack.add(new J9StaticsCommand());
    toPassBack.add(new JitstackCommand());
    toPassBack.add(new LocalMapCommand());
    toPassBack.add(new StackmapCommand());
    toPassBack.add(new J9ClassShapeCommand());
    toPassBack.add(new FindVMCommand());
    toPassBack.add(new ShrCCommand());
    toPassBack.add(new QueryRomClassCommand());
    toPassBack.add(new RamClassSummaryCommand());
    toPassBack.add(new RomClassSummaryCommand());
    toPassBack.add(new ClassloadersSummaryCommand());
    toPassBack.add(new ExtendedMethodFlagInfoCommand());
    toPassBack.add(new AnalyseRomClassUTF8Command());
    toPassBack.add(new J9MemTagCommands());
    toPassBack.add(new CompressedRefMappingCommand());
    toPassBack.add(new ShowDumpAgentsCommand());
    toPassBack.add(new NativeMemInfoCommand());
    toPassBack.add(new SetVMCommand());
    toPassBack.add(new TraceConfigCommand());
    toPassBack.add(new WalkJ9PoolCommand());
    toPassBack.add(new J9RegCommand());
    toPassBack.add(new CoreInfoCommand());
    toPassBack.add(new GCCheckCommand());
    toPassBack.add(new DumpStringTableCommand());
    toPassBack.add(new SearchStringTableCommand());
    toPassBack.add(new RomClassForNameCommand());
    toPassBack.add(new RuntimeSettingsCommand());
    toPassBack.add(new RootPathCommand());
    toPassBack.add(new HashCodeCommand());
    toPassBack.add(new MonitorsCommand());
    toPassBack.add(new MarkMapCommand());
    toPassBack.add(new DumpSegregatedStatsCommand());
    toPassBack.add(new ObjectSizeInfo());
    toPassBack.add(new DumpContendedLoadTable());
    loadPlugins(toPassBack, loader);
    passbackArray[0] = toPassBack;
}
Also used : TraceConfigCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.TraceConfigCommand) RomClassSummaryCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RomClassSummaryCommand) VmCheckCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.VmCheckCommand) DumpSegregatedStatsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpSegregatedStatsCommand) FindMethodFromPcCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.FindMethodFromPcCommand) J9StaticsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.J9StaticsCommand) ITableSizeCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ITableSizeCommand) DumpRomClassCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpRomClassCommand) StackmapCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.StackmapCommand) VMConstantPoolCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.VMConstantPoolCommand) DumpSegmentsInListCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpSegmentsInListCommand) BuildFlagsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.BuildFlagsCommand) WalkJ9PoolCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.WalkJ9PoolCommand) SetVMCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.SetVMCommand) DumpAllRamClassLinearCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllRamClassLinearCommand) StackWalkCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.StackWalkCommand) ClassForNameCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ClassForNameCommand) RomClassForNameCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RomClassForNameCommand) ClassloadersSummaryCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ClassloadersSummaryCommand) DumpAllSegmentsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllSegmentsCommand) AnalyseRomClassUTF8Command(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.AnalyseRomClassUTF8Command) DumpRamClassLinearCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpRamClassLinearCommand) DumpAllClassloadersCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllClassloadersCommand) NativeMemInfoCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.NativeMemInfoCommand) AllClassesCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.AllClassesCommand) J9VTablesCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.J9VTablesCommand) GCCheckCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.GCCheckCommand) SearchStringTableCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.SearchStringTableCommand) WalkInternTableCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.WalkInternTableCommand) FindOverlappingSegmentsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.FindOverlappingSegmentsCommand) DumpStringTableCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpStringTableCommand) DumpAllRomClassLinearCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllRomClassLinearCommand) CompressedRefMappingCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.CompressedRefMappingCommand) J9ClassShapeCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.J9ClassShapeCommand) DumpRomClassLinearCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpRomClassLinearCommand) FindPatternCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.FindPatternCommand) RamClassSummaryCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RamClassSummaryCommand) RuntimeSettingsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RuntimeSettingsCommand) LocalMapCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.LocalMapCommand) ObjectSizeInfo(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ObjectSizeInfo) ICommand(com.ibm.j9ddr.tools.ddrinteractive.ICommand) MonitorsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand) DumpContendedLoadTable(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpContendedLoadTable) J9MemTagCommands(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.J9MemTagCommands) QueryRomClassCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.QueryRomClassCommand) JitstackCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.JitstackCommand) FindVMCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.FindVMCommand) DumpAllRegionsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllRegionsCommand) FindStackValueCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.FindStackValueCommand) RootPathCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RootPathCommand) ACCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ACCommand) DumpRomMethodCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpRomMethodCommand) J9RegCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.J9RegCommand) ShrCCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ShrCCommand) MarkMapCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MarkMapCommand) JitMetadataFromPcCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.JitMetadataFromPcCommand) RomClassForNameCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.RomClassForNameCommand) ExtendedMethodFlagInfoCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ExtendedMethodFlagInfoCommand) CoreInfoCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.CoreInfoCommand) ShowDumpAgentsCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.ShowDumpAgentsCommand) HashCodeCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.HashCodeCommand) MethodForNameCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MethodForNameCommand) BytecodesCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.BytecodesCommand)

Example 2 with MonitorsCommand

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.

the class ThreadsCommand method monitors.

/**
 * Prints all of the J9ObjectMonitors in the list of monitor tables.
 *
 * NOTE: It does not dump system monitors found in the thread lib monitor_pool
 *
 * @param out the PrintStream to write output to
 *
 * @see {@link MonitorsCommand}
 */
private void monitors(PrintStream out) throws DDRInteractiveCommandException {
    try {
        MonitorTableListIterator iterator = new MonitorTableListIterator();
        MonitorTable previousMonitorTable = null;
        while (iterator.hasNext()) {
            J9ObjectMonitorPointer objectMonitorPointer = iterator.next();
            MonitorTable currentMonitorTable = iterator.currentMonitorTable();
            if (!currentMonitorTable.equals(previousMonitorTable)) {
                /* Print header for new monitor table */
                out.append("Table = " + currentMonitorTable.getTableName() + ", itemCount=" + currentMonitorTable.getCount());
                out.append(nl);
            }
            out.append(String.format("\n    !j9thread 0x%s    !j9threadmonitor 0x%s", Long.toHexString(objectMonitorPointer.monitor().owner().getAddress()), Long.toHexString(objectMonitorPointer.monitor().getAddress())));
            out.append(nl);
            previousMonitorTable = currentMonitorTable;
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : 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 3 with MonitorsCommand

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.

the class MonitorsCommand method objectCommand.

/**
 * See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
 * function documentation
 *
 * @param args
 *            command args
 * @param out
 *            the output stream
 */
private void objectCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
    FilterOptions filter = FilterOptions.defaultOption();
    try {
        J9ObjectPointer object = null;
        if (args.length < 2) {
            out.println("This command takes one address \"!monitors object <J9Object address>\"");
            return;
        }
        long objectAddr = Long.decode(args[1]);
        object = J9ObjectPointer.cast(objectAddr);
        ObjectMonitor objMonitor = ObjectMonitor.fromJ9Object(object);
        if (null == objMonitor) {
            out.printf("No corresponding monitor was found for %s\n", object.getHexAddress());
        } else {
            writeObjectMonitor(filter, objMonitor, out);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

Example 4 with MonitorsCommand

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand in project openj9 by eclipse.

the class MonitorsCommand method j9threadCommand.

/**
 * See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
 * function documentation
 *
 * @param args
 *            command args
 * @param out
 *            the output stream
 * @throws DDRInteractiveCommandException
 */
private void j9threadCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
    if (args.length < 2) {
        out.println("This command takes one address argument: \"!monitors j9thread <address>\"");
        return;
    }
    try {
        long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        VoidPointer ptr = VoidPointer.cast(address);
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9VMThreadPointer mainThread = vm.mainThread();
        if (mainThread.isNull() || mainThread.osThread().isNull() || mainThread.osThread().library().isNull()) {
            throw new CorruptDataException("Cannot locate thread library");
        }
        J9ThreadLibraryPointer lib = mainThread.osThread().library();
        J9PoolPointer pool = lib.thread_pool();
        Pool<J9ThreadPointer> threadPool = Pool.fromJ9Pool(pool, J9ThreadPointer.class);
        SlotIterator<J9ThreadPointer> poolIterator = threadPool.iterator();
        J9ThreadPointer osThreadPtr = null;
        while (poolIterator.hasNext()) {
            if (ptr.equals(poolIterator.next())) {
                osThreadPtr = J9ThreadPointer.cast(ptr);
            }
        }
        if (null == osThreadPtr) {
            throw new DDRInteractiveCommandException(String.format("Could not find any j9thread at address %s\n", ptr.getHexAddress()));
        }
        // Is there an associated J9VMThread?
        J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(osThreadPtr);
        // Step 1: Print the general info for the VM and native threads:
        out.println(String.format("%s\t%s\t// %s", osThreadPtr.formatShortInteractive(), vmThread.notNull() ? vmThread.formatShortInteractive() : "<none>", vmThread.notNull() ? J9VMThreadHelper.getName(vmThread) : "[osthread]"));
        printMonitorsForJ9Thread(out, vm, osThreadPtr);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9ThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer) J9PoolPointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer) 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) J9ThreadLibraryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadLibraryPointer)

Example 5 with MonitorsCommand

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.MonitorsCommand 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)

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