Search in sources :

Example 1 with UtModuleInfoPointer

use of com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer 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 UtModuleInfoPointer

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

the class TraceConfigCommand method printActiveTracePoints.

private void printActiveTracePoints(UtModuleInfoPointer modInfo, PrintStream out) throws CorruptDataException {
    int count = modInfo.count().intValue();
    U8Pointer active = modInfo.active();
    String moduleName = moduleName(modInfo);
    for (int i = 0; i < count; i++) {
        long state = active.at(i).longValue();
        if (state != RastraceInternalConstants.UT_NONE || verbose) {
            String stateStr = decodeTraceActivationState(state);
            out.println(moduleName + "." + i + " =" + stateStr);
        }
    }
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 3 with UtModuleInfoPointer

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

the class TraceConfigCommand method moduleName.

private static String moduleName(UtModuleInfoPointer modInfo) throws CorruptDataException {
    UtModuleInfoPointer containerModInfo = modInfo.containerModule();
    String moduleName = modInfo.name().getCStringAtOffset(0, modInfo.namelength().intValue());
    if (containerModInfo != null && containerModInfo.notNull()) {
        String containerName = containerModInfo.name().getCStringAtOffset(0, containerModInfo.namelength().intValue());
        return containerName + "(" + moduleName + ")";
    } else {
        return moduleName;
    }
}
Also used : UtModuleInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer)

Example 4 with UtModuleInfoPointer

use of com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer 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

UtModuleInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 UtComponentDataPointer (com.ibm.j9ddr.vm29.pointer.generated.UtComponentDataPointer)2 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1 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