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();
}
}
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);
}
}
}
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;
}
}
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();
}
}
Aggregations