Search in sources :

Example 1 with Command

use of com.ibm.j9ddr.tools.ddrinteractive.Command in project openj9 by eclipse.

the class SnapFormatWrapperCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if ((args.length > 0) && (args[0].equals("-help") || args[0].equals("-h") || args[0].equals("-?"))) {
        out.println("Format selected trace buffers.");
        out.println();
        out.println("   -f <filename>            Write output to the specified file (default is stdout)");
        out.println();
        out.println("   -d <datfile_directory>   Set the directory to search for the trace format database");
        out.println();
        out.println("   -t <thread_id>           Only output trace information for the specified J9VMThread");
        out.println();
        out.println("   -s <filter>              Only output tracepoints that match the filter expression.");
        out.println("                            A filter expression consists of one or more tracepoint IDs");
        out.println("                            combined with AND, OR, and NOT operators (&, |, !).");
        out.println("      Examples:");
        out.println("         -s j9vm                            Print all tracepoints in component 'j9vm'");
        out.println("         -s j9vm|j9mm                       Print all tracepoints in components 'j9vm' and 'j9mm'");
        out.println("         -s {entry}                         Only print 'Entry' tracepoints");
        out.println("         -s j9vm.0-99                       Only print 'j9vm' tracepoints with IDs below 100");
        out.println("         -s j9scar&!(j9scar.59|j9scar.60)   Print j9scar tracepoints except for 59 and 60");
        return;
    }
    try {
        Class snapFormatCommandCls = Class.forName("com.ibm.j9ddr.tools.ddrinteractive.commands.SnapFormatCommand");
        Object snapFormatCommandInstance = snapFormatCommandCls.newInstance();
        if (snapFormatCommandInstance instanceof Command) {
            Command c = (Command) snapFormatCommandInstance;
            c.run(command, args, context, out);
        } else {
            throw new DDRInteractiveCommandException("Unable to format trace. Could not create formatter.");
        }
    } catch (ClassNotFoundException e) {
        // e.printStackTrace(out);
        throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
    } catch (IllegalAccessException e) {
        // e.printStackTrace(out);
        throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
    } catch (InstantiationException e) {
        // e.printStackTrace(out);
        throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
    } catch (SecurityException e) {
        // e.printStackTrace(out);
        throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
    } catch (IllegalArgumentException e) {
        // e.printStackTrace(out);
        throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
    }
// catch (java.lang.Error e) {
// /* Naughty catching this but good for catching unresolved com.ibm.jvm.trace.* problems. */
// //e.printStackTrace(out);
// throw new DDRInteractiveCommandException("Unable to format trace. " + e.getMessage(), e);
// }
}
Also used : Command(com.ibm.j9ddr.tools.ddrinteractive.Command) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)

Aggregations

Command (com.ibm.j9ddr.tools.ddrinteractive.Command)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1