Search in sources :

Example 1 with UtComponentDataPointer

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

the class TraceConfigCommand method walkTraceComponents.

/**
 * Walk the trace components and use the visitor pattern to save us writing this
 * loop several times.
 *
 * @param visitor the visitor object to run on each UtModuleInfo.
 * @param head the pointer to the first item in the list of UtComponentData
 * @param context
 * @param out
 */
private static void walkTraceComponents(final ModuleVisitor visitor, final UtComponentDataPointer head, Context context, PrintStream out) {
    UtComponentDataPointer current = head;
    try {
        while (current != null && current.notNull()) {
            UtModuleInfoPointer modInfo = current.moduleInfo();
            visitor.visit(modInfo);
            current = current.next();
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : UtModuleInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer) UtComponentDataPointer(com.ibm.j9ddr.vm29.pointer.generated.UtComponentDataPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 2 with UtComponentDataPointer

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

the class TraceConfigCommand method run.

public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        // !RasGlobalStorage
        RasGlobalStoragePointer rasGlobal = RasGlobalStoragePointer.cast(vm.j9rasGlobalStorage());
        // !UtGlobalData
        UtGlobalDataPointer utGlobal = UtGlobalDataPointer.cast(rasGlobal.utGlobalData());
        // !UtComponentList componentList
        UtComponentListPointer componentList = utGlobal.componentList();
        // !UtComponentData head
        UtComponentDataPointer head = componentList.head();
        if (args.length == 0) {
            walkTraceComponents(new ModuleVisitor() {

                public void visit(UtModuleInfoPointer modInfo) throws CorruptDataException {
                    out.println(moduleName(modInfo));
                }
            }, head, context, out);
        } else if ("all".equals(args[0])) {
            walkTraceComponents(new ModuleVisitor() {

                public void visit(UtModuleInfoPointer modInfo) throws CorruptDataException {
                    printActiveTracePoints(modInfo, out);
                }
            }, head, context, out);
        } else {
            for (int i = 0; i < args.length; i++) {
                final String componentName = args[i];
                walkTraceComponents(new ModuleVisitor() {

                    public void visit(UtModuleInfoPointer modInfo) throws CorruptDataException {
                        if (componentName.equals(moduleName(modInfo))) {
                            printActiveTracePoints(modInfo, out);
                        }
                    }
                }, head, context, out);
            }
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : UtModuleInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer) UtComponentListPointer(com.ibm.j9ddr.vm29.pointer.generated.UtComponentListPointer) UtGlobalDataPointer(com.ibm.j9ddr.vm29.pointer.generated.UtGlobalDataPointer) UtComponentDataPointer(com.ibm.j9ddr.vm29.pointer.generated.UtComponentDataPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) RasGlobalStoragePointer(com.ibm.j9ddr.vm29.pointer.generated.RasGlobalStoragePointer)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 UtComponentDataPointer (com.ibm.j9ddr.vm29.pointer.generated.UtComponentDataPointer)2 UtModuleInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer)2 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 RasGlobalStoragePointer (com.ibm.j9ddr.vm29.pointer.generated.RasGlobalStoragePointer)1 UtComponentListPointer (com.ibm.j9ddr.vm29.pointer.generated.UtComponentListPointer)1 UtGlobalDataPointer (com.ibm.j9ddr.vm29.pointer.generated.UtGlobalDataPointer)1